Mobius DrawKit Help contents

Creating a DrawKit application

1.Single Document Interface (SDI)

2.Multiple Document Interface (MDI).

Programming a new DrawObject

Methods and Theory

Tools using and creating your own

Methods and Theory

DrawObjects

DrawKit Language reference

These are the units included inDrawKit.

Click on each to move

to the next page of the help file.

DKTools	: Standard tool stuff

DKStDraw	: Draw objects, including TSuperline.

Controls	: Controls, TMovablePanel etc.

DrawKit	: TDrawSurface and TDrawObject.


Create

constructor Create (  AComponent  :  TComponent  )  ;  override  ;

Sets the GroupIndex property to 0.  In general decendants of TNullTool will not require to be in any radio button group.  If you need to change this then do so either in a subclass or visually in the propery editor.


CreateObject

procedure CreateObject (  ADrawSurface  :  TDrawSurface  ;

                                           var  AHandle  :  Integer  ;

                                           var  Adding  :  Boolean  )  :  TDrawObject  ;  override  ;

Returns nil in result and sets Adding = false.  Adding determines if we should be adding to this object or not.  If you override this method then you must set adding yourself.


Create

procedure Create (  AComponent  :  TComponent  )  ;  override  ;

TPointerTool is a special to case of NullTool which sets GroupIndex to 1, although TPointerTool does not create other objects it will usually be used in a group along with other tools, ie ellipse or rectangle.

TPointerTool is also treated specially in the DrawSurface engine, you must not change TPointerTool in any way in this version of DrawKit.


SetParent

procedure SetParent (  AParent  :  TWinControl  )  ;  override  ;

Does nothing in this version of DrawKit.


GetCurrentMultiObject

function GetCurrentMultiObject (  ADrawSurface  :  TDrawSurface  )  :  TMultiPartObject  ;

GetCurrentMultiObject returns the currently selected multi part object in the DrawSurface, ADrawSurface.  This is used MultiPartTools CreateObject method. CreateObject will either create a new object or add to the DrawObject returned by this function.


CreateObject

function CreateObject (  ADrawSurface  :  TDrawSurface  ;

                                       var  AHandle  :  Integer  ;

                                       var  Adding  :  Boolean  )  :  TDrawObject  ;  override  ;

Creating a new Multipart DrawObject

MultipartTool.CreateObject calls GetCurrentMultiObject to find the currently selected TMultiPartObject or descendant of TMultiPartObject, if this value is nil then CreateObject creates a new object by calling the inherited CreateObject method. Inherited CreateObject uses the type of the object stored in the TTool.DrawObject field with runtime type information to create the new object. This method is called by CreateDrawObject in ADrawSurface.

Adding to an existing MulriPartObject.

If GetCurrentMultiObject returns a MutliPartObject then this DrawObject is retuned, Adding is set to true and AHandle is set to 2 by default.

The DrawSurface CreateDrawObject will then start the adding process which calls PartHandle to determine which handle should be added to.  This by default sets the handle to the last handle in the list.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

Bring objects to front

Calls ADrawSurface.BringObjectsToFront. BringObjectsToFront brings all selected objects to the front of the DrawSurface and invalidates the nescessarry rectangles for repainting.

It is possible to manipulate the DrawSurface from here rather than just calling in to DrawSurface routines. ADrawSurface is the current DrawSurface that has focus. Focus is determined by which form containing a DrawSurface is in front. If more than one DrawSurface is in one form then the last DrawSurface to have focus by mouse click or other means is the current DrawSurface.

Drawsurface manipulation

DrawObjects is a list of all the objects in the DrawSurface and SelectedObjects is a list of all the selected objects. Later versions will allow layering control and will support bring to fron n* layers.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

Send objects to back

Calls ADrawSurface.SendObjectsToBack. SendObjectsToBack sends all selected objects to the back of the DrawSurface and invalidates the nescessarry rectangles for repainting.

It is possible to manipulate the DrawSurface from here rather than just calling in to DrawSurface routines. ADrawSurface is the current DrawSurface that has focus. Focus is determined by which form containing a DrawSurface is in front. If more than one DrawSurface is in one form then the last DrawSurface to have focus by mouse click or other means is the current DrawSurface.

Drawsurface manipulation

DrawObjects is a list of all the objects in the DrawSurface and SelectedObjects is a list of all the selected objects. Later versions will allow layering control and will support send to back n* layers.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

Undo

Undo calls ADrawSurface.Undo. This method in the drawsurface manipulates UndoList which is a pivate List in the DrawSurface. Undo runs the previous undoable event in the list setting UndoState to usUndo.  You will not need to override this method. If you need your own undo handling then create an object subclassed from TUndoObject.  TUndoObject calls the DrawObjects own undo method, it can also handle all the undoing for you.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

Redo

Redo calls ADrawSurface.Redo. This method in the drawsurface manipulates UndoList which is a pivate List in the DrawSurface. Undo runs the next undoable event in the list setting UndoState to usRedo.  You will not need to override this method. If you need your own undo handling then create an object subclassed from TUndoObject.  TUndoObject calls the DrawObjects own undo method, it can also handle all the undoing for you.


NewDrawSurface


FDialog


FOnLoadObjects


FOpenMode


SetOpenMode

procedure SetOpenMode (  AnOpenMode  :  TOpenMode  )  ;

SetOPenMode is called by the property OpenMode whenever a new open mode needs to be set.

SetOPenMode sets the dialog stored in Dialogs title to

omOpen   : Dialog.Title := 'Open' ;

omPlace   : Dialog.Title := 'Place object' ;

omImport  : Dialog.Title := 'Import object' ;

According to to open mode.


Create

constructor Create (  AComponent  :  TComponent  )  ;  override  ;

This constructor sets OpenMode to omOpen.  This is the default setting for this tool.  omOpen means that when the Dialog is shown Open will appear in its caption, and If the Click is called when you are running in a MDI frame work a new window will be created according to the return of the OnLoadObjects events Aform variable parameter.


MouseDown

procedure MouseDown (  Button  :  TMouseButton  ;

                                         Shift  :  TShiftState  ;

                                         X, Y  :  Integer  )  ;  override  ;

This method is not implented in this version of DrawKit.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

Does nothing here.


SetDialog

procedure SetDialog (  ADialog  :  TOpenDialog  )  ;  virtual  ;

Called by the Dialog property to set the new Dialog.


GetDialog

function GetDialog  :  TOpenDialog ; virtual  ;

GetDialog returns the dialog in Dialog.


Click

procedure Click ; override ;

Opening DrawObjects files

Click attempts to execute the dialog in the Dialog property to obtain the name of the file the user wishes to open. It also calls its OnLoadObjects event to allow the user to perform any preloading actions. These actions include,  in an MDI framework, creating a new Mdi child form. This form is returned in the AForm parameter of the OnLoadObjects event.  Click then calls the LoadDrawObjects method in the current DrawSurface or the newly created DrawSurface according to the OpenMode settings.

Placing DrawObjects files

If OpenMode is set to omPlace the LoadDrawObjects sets the cursor to the either the cursor stored in PlaceCursor if this is not nil or the cursor stored as a resource (.res) under the name stored in the property PlaceCursorName.  DrawSurface waits for the user to click and then places the object or draw file at the current coordinates.


OpenClick

procedure OpenClick (  ASender  :  TObject  )  ;  virtual  ;

Does nothing in this version of DrawKit.


PlaceClick

procedure PlaceClick (  ASender  :  TObject  )  ;  virtual  ;

Does nothing in this version of DrawKit.


Dialog

Dialog  :  TOpenDialog  read  GetDialog  write  SetDialog  ;

This is the Dialog which is executed in the click method. The dialog has to be set by the user at design time for this tool to function correctly.


OnLoadObjects

OnLoadObjects  :  TLoadEvent  read  FOnLoadObjects  write  FOnLoadObjects  ;

OnLoadObject allows the user to perform any preloading actions. These actions include,  in an MDI framework, creating a new MDI child form. This form is returned in the AForm parameter of the OnLoadObjects event.  AnOpenMode is set to the Tools cuddrent OpenMode.


OpenMode

OpenMode  :  TOpenMode  read  FOpenMode  write  SetOpenMode  default  omOpen  ;

type

  TOpenMode = ( omOpen, omImport, omPlace ) ;

OPenMode determines the behavior of LoadDrawObjects. OpenMode calls SetoPenMode which sets the Dialogs title to the appropriate heading, on of the following

omOpen   : Dialog.Title := 'Open' ;

omPlace   : Dialog.Title := 'Place object' ;

omImport  : Dialog.Title := 'Import object' ;


FDialog


FSaveType


FGetForm


Create

Create (  AComponent  :  TComponent  )  ;  override  ;

Save as..

TSave.Create sets SaveType to stSaveAs. When SaveType is equal to stSaveAs a SaveAs Dialog is always executed when the tool recieves a click.

Save..

When SaveType is stSave then the this tool attempts to save the objects on the current DrawSurface. If the current file name is noname(1..n).tmp then a save as Dialog is executed.


ToolClick

ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

SaveAs..

If the current application framework is not MDI then TSave.ToolClick calls its own OnGetForm event to return a form,  and uses this form to set its caption if SaveMode is stSaveAs.  If we are using MDI then the ActiveMDIchilds caption is changed to the current name of the drawfiles just saved.

Save..

If SaveMode is stSave then ToolClick attemps to save the DrawObjects in the current DrawSurface.


SetDialog

procedure SetDialog (  ADialog  :  TSaveDialog  )  ;  virtual  ;

SetDialog is called by the Dialog property. This method sets the filter, and OverWritePrompt option of the Dialog

the filter is set to:

    Filter := Filter + 'Draw files|*.drw' ;

    Filter := Filter + '|Windows Metafile (.wmf)|*.wmf' ;

    Filter := Filter + '|Bitmap Files(*.bmp)|*.bmp' ;


GetDialog

function GetDialog  :  TSaveDialog ; virtual  ;

Returns the Dialog.


Dialog

Dialog  :  TSaveDialog  read  GetDialog  write  SetDialog  ;

This is the Dialog which is executed in the click method. The dialog has to be set by the user at design time for this tool to function correctly.


SaveType

SaveType  :  TSaveType  read  FSaveType  write  FSaveType  default  stSaveAs  ;

type TSaveType = ( stSave, stSaveAs ).

Setting this property sets the Dialogs title to either Save or Save as respectively. It also determines the way the SaveDrawObjects method acts.

Save as..

If SaveType is stSaveAs then a new file is created with the name and directory selected by the user. The file is alos saved as the given type currently either .BMP/.WMF or .DRW.

Save..

If SaveType is stSave then the tool trys to save the current DrawSurfaces DrawObjects using the current DrawObjects file name. If this name is noname(1..n).tmp then a SaveAs dialog is executed to return a corect file name.


OnGetForm

OnGetForm  :  TGetFormEvent  read  FGetForm  write  FGetForm  ;

This event is called when the tool requires a form.


FDialog


Create

constructor Create (  AComponent  :  TComponent  )  ;  override  ;

Calls the inherited Create constructor.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

Prints the current DrawSurface to the Current printer set up by the user.


SetDialog

procedure SetDialog (  ADialog  :  TPrintDialog  )  ;  virtual  ;

Sets the print dialog.


GetDialog

function GetDialog  :  TPrintDialog ; virtual ;

Returns the print Dialog.


Dialog

Dialog : TPrintDialog  read  GetDialog  write  SetDialog ;

Stores the print Dialog.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

Not implemented in this version of DrawKit.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

Not implemented in this version of DrawKit.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  override  ;

TLineSpec.ToolClick displays LineFillDlg created by this tool. The LineFillDlg allows the user to set various colors and line thicknesses at run time and displays the changes on a sample object before the user comits to the changes by pressing the Ok button. No changes will be made if the cancel buttonis pressed.


DKTools

These are the objects and classes in the DKTools unit click on the underlined text to enter that help topic.

TNullTool

TPointerTool

TMultiPartTool

TBringToFront

TSendToBack

TUndo

TRedo

TOpen

TSave

TPrint

TZoomIn

TZoomOut

TLineSpec


TNullTool

Methods

Create

CreateObject


TPointerTool

Methods

Create


TMultiPartTool

Methods

SetParent

GetCurrentMultiObject

CreateObject


TBringToFront

Methods

ToolClick


TSendToBack

Methods

ToolClick


TUndo

Methods

ToolClick


TRedo

Methods

ToolClick


TOpen

Fields

NewDrawSurface

FDialog

FOnLoadObjects

FOpenMode

Methods

SetOpenMode

Create

MouseDown

ToolClick

SetDialog

GetDialog

Click

OpenClick

PlaceClick

Properties

Dialog

OnLoadObjects

OpenMode


TSave

Fields

FDialog

FSaveType

FGetForm

Methods

Create

ToolClick

SetDialog

GetDialog

Properties

Dialog

SaveType

OnGetForm


TPrint

Fields

FDialog

Methods

Create

ToolClick

SetDialog

GetDialog

Properties

Dialog


TZoomIn

Method

ToolClick


TZoomOut

Method

ToolClick


TLineSpec

Method

ToolClick


TheObject


Create

Create (  ADrawObject  :  TDrawObject  ;

      AnObject  :  TObject  )  ;  virtual  ;


Undo

Undo (  ADrawSurface  :  TDrawSurface  ;

      AnUndoState  :  TUndoState  )  ;  virtual  ;


Handle


DrawPoint


Create

Create (  ADrawObject  :  TDrawObject  ;

      AHandle  :  Integer  ;

      ADrawPoint  :  TDrawPoint  )  ;  virtual  ;


Destroy

Destroy  ;  override  ;


Handle


DrawPoint


FencingPoints


FencingBounds


OldPen


OldBrush


InvalidBounds


FPoints


FLineBrush


FLinePen


Connected


ReadPoints

ReadPoints (  AReader  :  TReader  ;

      var  AList  :  TList  ;

      ACount  :  Integer  )  ;  virtual  ;


WritePoints

WritePoints (  AWriter  :  TWriter  ;

      AList  :  TList  )  ;  virtual  ;


ReadState

ReadState (  Reader  :  TReader  )  ;  override  ;


WriteState

WriteState (  Writer  :  TWriter  )  ;  override  ;


SetCanvas

SetCanvas (  ACanvas  :  TCanvas  )  ;  override  ;


CalcLine

CalcLine (  dx  ,  dy  :  integer  ;

      var  APoints  :  TList  ;

      AHandle  :  Integer  )  ;  virtual  ;


DrawLine

DrawLine (  ACanvas  :  TCanvas  ;

      APoints  :  TList  ;

      GetRect  :  Boolean  )  :  TRect  ;  virtual  ;


Resize

Resize (  dx  ,  dy  :  integer  ;

      AHandle  :  Integer  ;

      DoInvalidate  :  boolean  ;

      DoResize  :  boolean  )  ;  override  ;


InvalidateObject

InvalidateObject (  ADrawSurface  :  TDrawSurface  ;

      EraseFirst  :  Boolean  )  ;  override  ;


GetInvalidBounds

GetInvalidBounds  :  TRect  ;

      override  ;


GetPointFromHandle

GetPointFromHandle (  AHandle  :  Integer  )  :  TDrawPoint  ;  virtual  ;


Change

Change (  AnObject  :  TObject  )  ;  virtual  ;


CheckHandleHit

CheckHandleHit (  AnX  ,  AY  :  Integer  ;

      APoint  :  TPoint  )  :  Boolean  ;


BrushChange

BrushChange (  ASender  :  TObject  )  ;  dynamic  ;


PenChange

PenChange (  ASender  :  TObject  )  ;  dynamic  ;


ChangeChildren

ChangeChildren (  ASender  :  TObject  ;

      ASelected  :  Boolean  )  ;  dynamic  ;


Create

Create (  AnOwner  :  TComponent  )  ;  override  ;


Destroy

Destroy  ;  override  ;


SetupDrawObject

SetupDrawObject (  AParent  :  TComponent  ;

      ACanvas  :  TCanvas  ;

      ASetupType  :  Integer  ;

      ADrawObject  :  TDrawObject  )  ;  override  ;


Paint

Paint (  ASender  :  TObject  ;

      ACanvas  :  TCanvas  )  ;  override  ;


Fence

Fence (  ADrawSurface  :  TDrawSurface  ;

      ABounds  :  TRect  ;

      AHandle  :  Integer  ;

      dx  ,  dy  :  Integer  ;

      AFenceType  :  TFenceType  )  ;  override  ;


GetBrush

GetBrush  :  TBrush  ;

      virtual  ;


GetPen

GetPen  :  TPen  ;

      virtual  ;


CalculateBounds

CalculateBounds  :  TRect  ;

      override  ;


Points

Points  :  TList  read  FPoints  write  FPoints  ;


LineBrush

LineBrush  :  TBrush  read  GetBrush  write  FLineBrush  ;


LinePen

LinePen  :  TPen  read  GetPen  write  FLinePen  ;


Paint

Paint (  ASender  :  TObject  ;

      ACanvas  :  TCanvas  )  ;  override  ;


Fence

Fence (  ADrawSurface  :  TDrawSurface  ;

      ABounds  :  TRect  ;

      AHandle  :  Integer  ;

      dx  ,  dy  :  Integer  ;

      AFenceType  :  TFenceType  )  ;  override  ;


Paint

Paint (  ASender  :  TObject  ;

      ACanvas  :  TCanvas  )  ;  override  ;


Fence

Fence (  ADrawSurface  :  TDrawSurface  ;

      ABounds  :  TRect  ;

      AHandle  :  Integer  ;

      dx  ,  dy  :  Integer  ;

      AFenceType  :  TFenceType  )  ;  override  ;


FCornerHeight


FCornerWidth


Create

Create (  AnOwner  :  TComponent  )  ;  override  ;


Paint

Paint (  ASender  :  TObject  ;

      ACanvas  :  TCanvas  )  ;  override  ;


Fence

Fence (  ADrawSurface  :  TDrawSurface  ;

      ABounds  :  TRect  ;

      AHandle  :  Integer  ;

      dx  ,  dy  :  Integer  ;

      AFenceType  :  TFenceType  )  ;  override  ;


SetupDrawObject

SetupDrawObject (  AParent  :  TComponent  ;

      ACanvas  :  TCanvas  ;

      ASetupType  :  Integer  ;

      ADrawObject  :  TDrawObject  )  ;  override  ;


CornerWidth

CornerWidth  :  Integer  read  FCornerWidth  write  FCornerWidth  default  20  ;


CornerHeight

CornerHeight  :  Integer  read  FCornerHeight  write  FCornerHeight  default  20  ;


FirstPoint


FencePoints


Create

Create (  AnOwner  :  TComponent  )  ;  override  ;


Destroy

Destroy  ;  override  ;


SetupDrawObject

SetupDrawObject (  AParent  :  TComponent  ;

      ACanvas  :  TCanvas  ;

      ASetupType  :  Integer  ;

      ADrawObject  :  TDrawObject  )  ;  override  ;


Paint

Paint (  ASender  :  TObject  ;

      ACanvas  :  TCanvas  )  ;  override  ;


CalcLine

CalcLine (  dx  ,  dy  :  integer  ;

      var  APoints  :  TList  ;

      AHandle  :  Integer  )  ;  override  ;


MouseDrag

MouseDrag (  ADrawSurface  :  TDrawSurface  ;

      APoint  :  TPoint  ;

      AHandle  :  Integer  )  :  Boolean  ;  override  ;


Resize

Resize (  dx  ,  dy  :  integer  ;

      AHandle  :  Integer  ;

      DoInvalidate  :  boolean  ;

      DoResize  :  boolean  )  ;  override  ;


Undo

Undo (  AnUndoObject  :  TUndoObject  ;

      AnUndoState  :  TUndoState  ;

      ADrawSurface  :  TDrawSurface  )  ;  override  ;


GetLineSegment

GetLineSegment (  ASegmentNo  :  Integer  ;

      var  Point1  ,  Point2  :  TPoint  )  :  Boolean  ;


GetSelectedHandle

GetSelectedHandle  :  TDrawPoint  ;


FenceLine

FenceLine (  ACanvas  :  TCanvas  ;

      var  APoints  :  array  of  TDrawPoint  ;

      AHandle  :  Integer  )  ;  virtual  ;


DrawHandleFromPoint

DrawHandleFromPoint (  ACanvas  :  TCanvas  ;

      ADrawPoint  :  TDrawPoint  )  ;  override  ;


CalculateBounds

CalculateBounds  :  TRect  ;

      override  ;


CalcFenceLine

CalcFenceLine (  ACanvas  :  TCanvas  ;

      dx  ,  dy  :  integer  ;

      APoints  :  TList  ;

      var  A3Points  :  array  of  TDrawPoint  ;

      AHandle  :  Integer  )  ;  virtual  ;


CalcLine

CalcLine (  dx  ,  dy  :  integer  ;

      var  APoints  :  TList  ;

      AHandle  :  Integer  )  ;  override  ;


GetDrawPoint

GetDrawPoint (  AHandle  :  Integer  )  :  TDrawPoint  ;  virtual  ;


GetCursor

GetCursor (  AHandle  :  Integer  )  :  TCursor  ;  override  ;


SelectHandle

SelectHandle (  ADrawSurface  :  TDrawSurface  ;

      AnOnOff  :  Boolean  ;

      AHandle  :  Integer  )  ;  override  ;


Undo

Undo (  AnUndoObject  :  TUndoObject  ;

      AnUndoState  :  TUndoState  ;

      ADrawSurface  :  TDrawSurface  )  ;  override  ;


DrawColoredHandle

DrawColoredHandle (  ACanvas  :  TCanvas  ;

      ADrawPoint  :  TDrawPoint  ;

      AColor  :  TColor  )  ;


DrawHandles

DrawHandles (  ADrawSurface  :  TDrawSurface  ;

      ARect  :  TRect  ;

      AHandle  :  Integer  )  ;  override  ;


AreaSelect

AreaSelect (  ARect  :  TRect  ;

      AShift  :  TShiftState  )  :  Boolean  ;  override  ;


SetupDrawObject

SetupDrawObject (  AParent  :  TComponent  ;

      ACanvas  :  TCanvas  ;

      ASetupType  :  Integer  ;

      ADrawObject  :  TDrawObject  )  ;  override  ;


Create

Create (  AnOwner  :  TComponent  )  ;  override  ;


Resize

Resize (  dx  ,  dy  :  integer  ;

      AHandle  :  Integer  ;

      DoInvalidate  :  boolean  ;

      DoResize  :  boolean  )  ;  override  ;


StretchFence

StretchFence (  ADrawSurface  :  TDrawSurface  ;

      AHandle  :  Integer  ;

      dx  ,  dy  :  Integer  ;

      AFenceType  :  TFenceType  )  ;  override  ;


Fence

Fence (  ADrawSurface  :  TDrawSurface  ;

      ABounds  :  TRect  ;

      AHandle  :  Integer  ;

      dx  ,  dy  :  Integer  ;

      AFenceType  :  TFenceType  )  ;  override  ;


MouseDrag

MouseDrag (  ADrawSurface  :  TDrawSurface  ;

      APoint  :  TPoint  ;

      AHandle  :  Integer  )  :  Boolean  ;  override  ;


GetHandle

GetHandle (  X  ,  Y  :  Integer  )  :  Integer  ;  override  ;


AddPart

AddPart (  ADrawSurface  :  TDrawSurface  ;

      APoint  :  TPoint  )  ;  override  ;


PartHandle

PartHandle  :  Integer  ;

      override  ;


EffectTool

EffectTool  default  False  ;


FClosed


SetClosed

SetClosed (  AClosed  :  Boolean  )  ;


Closed

Closed  :  Boolean  read  FClosed  write  SetClosed  ;


Create

Create (  AnOwner  :  TComponent  )  ;  override  ;


ReadState

ReadState (  Reader  :  TReader  )  ;  override  ;


ToolChanged

ToolChanged (  ATool  :  TTool  )  ;  override  ;


Paint

Paint (  ASender  :  TObject  ;

      ACanvas  :  TCanvas  )  ;  override  ;


FenceLine

FenceLine (  ACanvas  :  TCanvas  ;

      var  APoints  :  array  of  TDrawPoint  ;

      AHandle  :  Integer  )  ;  override  ;


CalcFenceLine

CalcFenceLine (  ACanvas  :  TCanvas  ;

      dx  ,  dy  :  integer  ;

      APoints  :  TList  ;

      var  A3Points  :  array  of  TDrawPoint  ;

      AHandle  :  Integer  )  ;  override  ;


FDepth


BezierPoints


BezRect


Held


GetLineSegment

GetLineSegment (  ASegmentNo  :  Integer  ;

      var  Point1  ,  Point2  :  TPoint  )  :  Boolean  ;


GetSelectedHandle

GetSelectedHandle  :  TDrawPoint  ;


AddPolyPoint

AddPolyPoint (  APolyPoints  :  PPointArray  ;

      ADrawPoint  :  TDrawPoint  )  ;


ReadState

ReadState (  Reader  :  TReader  )  ;  override  ;


RenderPolyGon

RenderPolyGon (  APolyPoints  :  PPointArray  )  ;


FenceLine

FenceLine (  ACanvas  :  TCanvas  ;

      var  APoints  :  array  of  TDrawPoint  ;

      AHandle  :  Integer  )  ;  virtual  ;


DrawHandleFromPoint

DrawHandleFromPoint (  ACanvas  :  TCanvas  ;

      ADrawPoint  :  TDrawPoint  )  ;  override  ;


CalculateBounds

CalculateBounds  :  TRect  ;

      override  ;


CalculateHandleBounds

CalculateHandleBounds (  ARect  :  TRect  )  :  TRect  ;  virtual  ;


CalcFenceLine

CalcFenceLine (  ACanvas  :  TCanvas  ;

      dx  ,  dy  :  integer  ;

      APoints  :  TList  ;

      var  A3Points  :  array  of  TDrawPoint  ;

      AHandle  :  Integer  )  ;  virtual  ;


CalcLine

CalcLine (  dx  ,  dy  :  integer  ;

      var  APoints  :  TList  ;

      AHandle  :  Integer  )  ;  override  ;


GetDrawPoint

GetDrawPoint (  AHandle  :  Integer  )  :  TDrawPoint  ;  virtual  ;


GetCursor

GetCursor (  AHandle  :  Integer  )  :  TCursor  ;  override  ;


SelectHandle

SelectHandle (  ADrawSurface  :  TDrawSurface  ;

      AnOnOff  :  Boolean  ;

      AHandle  :  Integer  )  ;  override  ;


Undo

Undo (  AnUndoObject  :  TUndoObject  ;

      AnUndoState  :  TUndoState  ;

      ADrawSurface  :  TDrawSurface  )  ;  override  ;


DrawColoredHandle

DrawColoredHandle (  ACanvas  :  TCanvas  ;

      ADrawPoint  :  TDrawPoint  ;

      AColor  :  TColor  )  ;


DrawLine

DrawLine (  ACanvas  :  TCanvas  ;

      APoints  :  TList  ;

      GetRect  :  Boolean  )  :  TRect  ;  override  ;


SubDivideBezier

SubDivideBezier (  APoint0  ,  APoint1  :  TLongPoint  ;

      APoint2  ,  APoint3  :  TLongPoint  ;

      ABezDepth  :  Integer  ;

      GetRect  :  Boolean  )  ;


DrawBezier

DrawBezier (  ACanvas  :  TCanvas  ;

      AControl1  ,  AControl2  :  TPoint  ;

      AHandle1  ,  AHandle2  :  TPoint  ;

      GetRect  :  Boolean  )  :  TRect  ;


DrawCurve

DrawCurve (  ACanvas  :  TCanvas  ;

      const  AStartPoint  :  TDrawPoint  ;

      const  AFinishPoint  :  TDrawPoint  ;

      GetRect  :  Boolean  )  :  TRect  ;


SetDepth

SetDepth (  ADepth  :  TDepth  )  ;


GetDepth

GetDepth  :  TDepth  ;


GetPointCount

GetPointCount  :  Integer  ;


MergePoints

MergePoints (  AFirst  ,  ALast  :  TDrawPoint  )  ;  dynamic  ;


Connect

Connect  ;  dynamic  ;


ConnectTo

ConnectTo (  ALineObject  :  TLineObject  ;

      ADrawPoint  :  TDrawPoint  ;

      ADrawSurface  :  TDrawSurface  )  ;  dynamic  ;


Destroy

Destroy  ;  override  ;


Create

Create (  AnOwner  :  TComponent  )  ;  override  ;


Paint

Paint (  ASender  :  TObject  ;

      ACanvas  :  TCanvas  )  ;  override  ;


DrawHandles

DrawHandles (  ADrawSurface  :  TDrawSurface  ;

      ARect  :  TRect  ;

      AHandle  :  Integer  )  ;  override  ;


AreaSelect

AreaSelect (  ARect  :  TRect  ;

      AShift  :  TShiftState  )  :  Boolean  ;  override  ;


SetupDrawObject

SetupDrawObject (  AParent  :  TComponent  ;

      ACanvas  :  TCanvas  ;

      ASetupType  :  Integer  ;

      ADrawObject  :  TDrawObject  )  ;  override  ;


Resize

Resize (  dx  ,  dy  :  integer  ;

      AHandle  :  Integer  ;

      DoInvalidate  :  boolean  ;

      DoResize  :  boolean  )  ;  override  ;


StretchFence

StretchFence (  ADrawSurface  :  TDrawSurface  ;

      AHandle  :  Integer  ;

      dx  ,  dy  :  Integer  ;

      AFenceType  :  TFenceType  )  ;  override  ;


Fence

Fence (  ADrawSurface  :  TDrawSurface  ;

      ABounds  :  TRect  ;

      AHandle  :  Integer  ;

      dx  ,  dy  :  Integer  ;

      AFenceType  :  TFenceType  )  ;  override  ;


MouseDrag

MouseDrag (  ADrawSurface  :  TDrawSurface  ;

      APoint  :  TPoint  ;

      AHandle  :  Integer  )  :  Boolean  ;  override  ;


GetHandle

GetHandle (  X  ,  Y  :  Integer  )  :  Integer  ;  override  ;


AddPart

AddPart (  ADrawSurface  :  TDrawSurface  ;

      APoint  :  TPoint  )  ;  override  ;


PartHandle

PartHandle  :  Integer  ;

      override  ;


MouseDown

MouseDown (  ADrawSurface  :  TDrawSurface  ;

      AButton  :  TMouseButton  ;

      AShiftState  :  TShiftState  ;

      AnX  :  Integer  ;

      AY  :  Integer  )  ;  override  ;


MouseUp

MouseUp (  ADrawSurface  :  TDrawSurface  ;

      AButton  :  TMouseButton  ;

      AShiftState  :  TShiftState  ;

      AnX  :  Integer  ;

      AY  :  Integer  )  ;  override  ;


GetDrawPointXY

GetDrawPointXY (  X  ,  Y  :  Integer  )  :  TDrawPoint  ;  virtual  ;


SetHandlesPos

SetHandlesPos (  ADrawPoint  :  TDrawPoint  )  ;  dynamic  ;


CopyPoint

CopyPoint (  ADest  ,  ASource  :  TDrawPoint  )  ;  dynamic  ;


Depth

Depth  :  TDepth  read  GetDepth  write  SetDepth  default  DefaultDepth  ;


EffectTool

EffectTool  default  False  ;


FDepth


BezierPoints


SetDepth

SetDepth (  ADepth  :  TDepth  )  ;


GetDepth

GetDepth  :  TDepth  ;


ReadState

ReadState (  Reader  :  TReader  )  ;  override  ;


WriteState

WriteState (  Writer  :  TWriter  )  ;  override  ;


DrawCurves

DrawCurves (  ACanvas  :  TCanvas  )  ;


DrawHandles

DrawHandles (  ADrawSurface  :  TDrawSurface  ;

      ARect  :  TRect  ;

      AHandle  :  Integer  )  ;  override  ;


SubDivideBezier

SubDivideBezier (  APoint0  ,  APoint1  :  TLongPoint  ;

      APoint2  ,  APoint3  :  TLongPoint  ;

      ABezDepth  :  Integer  )  ;


DrawBezier

DrawBezier (  ACanvas  :  TCanvas  ;

      AControl1  ,  AControl2  :  TPoint  ;

      AHandle1  ,  AHandle2  :  TPoint  )  ;


FenceLine

FenceLine (  ACanvas  :  TCanvas  ;

      var  APoints  :  array  of  TDrawPoint  ;

      AHandle  :  Integer  )  ;  override  ;


CalcFenceLine

CalcFenceLine (  ACanvas  :  TCanvas  ;

      dx  ,  dy  :  integer  ;

      APoints  :  TList  ;

      var  A3Points  :  array  of  TDrawPoint  ;

      AHandle  :  Integer  )  ;  override  ;


GetHandle

GetHandle (  X  ,  Y  :  Integer  )  :  Integer  ;  override  ;


Create

Create (  AnOwner  :  TComponent  )  ;  override  ;


Destroy

Destroy  ;  override  ;


SetupDrawObject

SetupDrawObject (  AParent  :  TComponent  ;

      ACanvas  :  TCanvas  ;

      ASetupType  :  Integer  ;

      ADrawObject  :  TDrawObject  )  ;  override  ;


AddPart

AddPart (  ADrawSurface  :  TDrawSurface  ;

      APoint  :  TPoint  )  ;  override  ;


Paint

Paint (  ASender  :  TObject  ;

      ACanvas  :  TCanvas  )  ;  override  ;


AfterCreate

AfterCreate (  ADrawSurface  :  TDrawSurface  )  ;  override  ;


AfterAddPart

AfterAddPart (  ADrawSurface  :  TDrawSurface  ;

      ADrawObject  :  TDrawObject  )  ;  override  ;


Depth

Depth  :  TDepth  read  GetDepth  write  SetDepth  default  DefaultDepth  ;


DKStDraw

These are the objects and classes in the DKStDraw unit. Click the underlined text to move to that help topic.

TPointClass

TUndoGraphicChange

TUndoDrawPointChange

TUndoConnect

TLineObject

TEllipse

TRectangle

TRoundRect

TFreeLine

TLine

TPolyLine

TSuperLine

TBezier


TPointClass


TUndoGraphicChange

TheObject

Create

Undo


TUndoDrawPointChange

Handle

DrawPoint

Create

Destroy


TUndoConnect

Handle

DrawPoint


TLineObject

Fields

FencingPoints

FencingBounds

OldPen

OldBrush

InvalidBounds

FPoints

FLineBrush

FLinePen

Connected

Methods

ReadPoints

WritePoints

ReadState

WriteState

SetCanvas

CalcLine

DrawLine

Resize

InvalidateObject

GetInvalidBounds

GetPointFromHandle

Change

CheckHandleHit

BrushChange

PenChange

ChangeChildren

Create

Destroy

SetupDrawObject

Paint

Fence

GetBrush

GetPen

CalculateBounds

Properties

Points

LineBrush

LinePen


TEllipse

Methods

Paint

Fence


TRectangle

Methods

Paint

Fence


TRoundRect

Fields

FCornerHeight

FCornerWidth

Methods

Create

Paint

Fence

SetupDrawObject

Properties

CornerWidth

CornerHeight


TFreeLine

Fields

FirstPoint

FencePoints

Methods

Create

Destroy

SetupDrawObject

Paint

CalcLine

MouseDrag

Resize

Undo


TLine

Methods

GetLineSegment

GetSelectedHandle

FenceLine

DrawHandleFromPoint

CalculateBounds

CalcFenceLine

CalcLine

GetDrawPoint

GetCursor

SelectHandle

Undo

DrawColoredHandle

DrawHandles

AreaSelect

SetupDrawObject

Create

Resize

StretchFence

Fence

MouseDrag

GetHandle

AddPart

PartHandle

Properties

EffectTool


TPolyLine

FClosed

SetClosed

Create

ReadState

ToolChanged

Paint

FenceLine

CalcFenceLine

Closed


TSuperLine

Fields

FDepth

BezierPoints

BezRect

Held

Methods

GetLineSegment

GetSelectedHandle

AddPolyPoint

ReadState

RenderPolyGon

FenceLine

DrawHandleFromPoint

CalculateBounds

CalculateHandleBounds

CalcFenceLine

CalcLine

GetDrawPoint

GetCursor

SelectHandle

Undo

DrawColoredHandle

DrawLine

SubDivideBezier

DrawBezier

DrawCurve

SetDepth

GetDepth

GetPointCount

MergePoints

Connect

ConnectTo

Destroy

Create

Paint

DrawHandles

AreaSelect

SetupDrawObject

Resize

StretchFence

Fence

MouseDrag

GetHandle

AddPart

PartHandle

MouseDown

MouseUp

GetDrawPointXY

SetHandlesPos

CopyPoint

Properties

Depth

EffectTool


TBezier

FDepth

BezierPoints

SetDepth

GetDepth

ReadState

WriteState

DrawCurves

DrawHandles

SubDivideBezier

DrawBezier

FenceLine

CalcFenceLine

GetHandle

Create

Destroy

SetupDrawObject

AddPart

Paint

AfterCreate

AfterAddPart

Depth


FAllowDocking


Create

constructor Create (  AnOwner  :  TComponent  )  ;  override  ;


AllowDocking

AllowDocking  :  Boolean  read  FAllowDocking  write  FAllowDocking  default  True  ;


DownPoint


dx


dy


OldY


OldX


LastY


LastX


OldTop


OldLeft


TearForm


Floating


FenceFloating


BaseRect


First


LastParent


OriginalParent


OriginalTop


OriginalLeft


OldBevelInner


OldBevelOuter


OldMoveable


InPanel


LastPanel


FMovable


FTearable


FTearCaption


FAllowAnyDock


FGraphicFence


FXGap


FYGap


SizeFence

procedure SizeFence (  var  ARect  :  TRect  ;

                                      ASizeType  :  TSizeType  )  ;


LeftButtonDown


GetParentXY

function GetParentXY (  var  AnX  ,  AY  :  Integer  )  : TPoint ; virtual ;


MouseDown

procedure MouseDown (  Button  :  TMouseButton  ;

                                         Shift  :  TShiftState  ;

                                         X, Y  :  Integer  )  ;  override  ;


MouseMove

procedure MouseMove (  Shift  :  TShiftState  ;

                                         X, Y  :  Integer  )  ;  override  ;


MouseUp

procedure MouseUp (  Button  :  TMouseButton  ;

                                     Shift  :  TShiftState  ;

                                     X, Y  :  Integer  )  ;  override  ;


TearFormClose

procedure TearFormClose (  Sender  :  TObject  ;

                                               var  Action  :  TCloseAction  )  ;


Loaded

Loaded  ;  override  ;


CalcRect

procedure CalcRect (  dx  ,  dy  :  integer  ;

                                    var  ARect  :  TRect  ;

                                    AHandle  :  Integer  )  ;  virtual  ;


EnterPanel

procedure EnterPanel (  APanel  :  TPanel  ;

                                       APoint  :  TPoint  )  ;  virtual  ;


ExitPanel

procedure ExitPanel (  APanel  :  TPanel  ;

                                     APoint  :  TPoint  )  ;  virtual  ;


Create

constructor Create (  AnOwner  :  TComponent  )  ;  override  ;


Destroy

destructor Destroy  ;  override  ;


Moveable

Moveable  :  Boolean  read  FMovable  write  FMovable  default True ;


TearCaption

TearCaption  :  String  read  FTearCaption  write  FTearCaption  ;


Tearable

Tearable  :  Boolean  read  FTearable  write  FTearable  default  False  ;


AllowAnyDock

AllowAnyDock  :  Boolean  read  FAllowAnyDock  write  FAllowAnyDock  default  False  ;


GraphicFence

GraphicFence  :  Boolean  read  FGraphicFence  write  FGraphicFence  default  False  ;


XGap

XGap  :  Integer  read  FXGap  write  FXGap  default  5  ;


YGap

YGap  :  Integer  read  FYGap  write  FYGap  default  5  ;


Controls

TMoveableDock

TMoveablePanel


TMoveableDock

Fields

FAllowDocking

Methods

Create

Properties

AllowDocking


TMoveablePanel

Fields

DownPoint

dx

dy

OldY

OldX

LastY

LastX

OldTop

OldLeft

TearForm

Floating

FenceFloating

BaseRect

First

LastParent

OriginalParent

OriginalTop

OriginalLeft

OldBevelInner

OldBevelOuter

OldMoveable

InPanel

LastPanel

FMovable

FTearable

FTearCaption

FAllowAnyDock

FGraphicFence

FXGap

FYGap

LeftButtonDown

Methods

SizeFence

GetParentXY

MouseDown

MouseMove

MouseUp

TearFormClose

Loaded

CalcRect

EnterPanel

ExitPanel

Create

Destroy

Properties

Moveable

TearCaption

Tearable

AllowAnyDock

GraphicFence

XGap

YGap


DrawObject

DrawObject points to the DrawObject that this Undo object wil act upon. DrawObject is set in the Create constructor.


Create

constructor Create (  ADrawObject  :  TDrawObject  )  ;  virtual  ;

Initializes the Undo object by by setting the DrawObject field with ADrawObject. Subclasses of TUndoObject must call this Create constructor by calling Inherited.


Undo

procedure  Undo (  ADrawSurface  :  TDrawSurface  ;

                               AnUndoState  :  TUndoState  )  ;  virtual  ;

Undo is called by the DrawSurface when the DrawSurfaces undo method is called.

By default Undo calls the DrawObjects Undo method passing Self, ADrawSurface is the DrawSurface the DrawObject is in and UndoState is set to usUndo or usRedo.


dx

dx stores the offset that was applied to the object and is set by the DrawSurface engine.


dy

dx stores the offset that was applied to the object and is set by the DrawSurface engine and is available to all subclasses of TUndoObject.


Handle

Handle is set to the handle that was moved or resize, this field is set by the DrawSurface engine and is available to all DrawSurface subclasses.


CopiedBounds

Copiedbounds stores the bounds of the object has has had a move or resize applied to it.


Create

constructor Create (  ADrawObject  :  TDrawObject  ;

                                  ADX  ,  ADY  :  Integer  ;

                                  AHandle  :  Integer  )  ;  virtual  ;

DrawObject is set to ASDrawObject in the inherited  Create constructor. dx is set to ADX, dy is set to ADY and Handle is set to AHandle


Undo

procedure Undo (  ADrawSurface  :  TDrawSurface  ;

                              AnUndoState  :  TUndoState  )  ;  override  ;

TUndoPosition calls the Draw object stored in the field DrawObjects Undo method pasing Self, ADrawSurface and AnUndoState. The DrawObjects undo either Redoes or Undoes this undo according to AnUndoState.


CopiedDrawObject

Not used.


BaseObject

BaseObject is set to the Mother object passed in the create constructor ABaseObject. For a discusion on the MotherObject theory see Mother objects in the main help contents Step by Step section


Create

constructor Create (  ADrawObject  :  TDrawObject  ;

                                  ABaseObject  :  TDrawObject  ;

                                  AnX, AY          :  Integer  )  ;  virtual  ;

This constructor calls Inherited Create passing ADrawObject to it.

BaseObject is set to the Mother object passed in ABaseObject. For a discusion on the MotherObject theory see Mother objects in the main help contents Step by Step section.

AnX and AY or not used here.


Undo

procedure Undo (  ADrawSurface  :  TDrawSurface  ;

                              AnUndoState  :  TUndoState  )  ;  override  ;

Undo

When AnUndoState is usUndo then the DrawObject is removed from ADrawSurfaces DrawObjects, and SelectedObjects lists. The DrawSurface is the invalidated causing a repaint.

Redo

When AnUndoState is usRedo then the DrawObject is added to ADrawSurfaces DrawObjects, and SelectedObjects list. The DrawSurface is the invalidated causing a repaint.


Undo

procedure Undo (  ADrawSurface  :  TDrawSurface  ;

                              AnUndoState  :  TUndoState  )  ;  override  ;

Undo

When AnUndoState is usUndo then the DrawObject is added to ADrawSurfaces DrawObjects, and SelectedObjects lists. The DrawObject is also removed from the DeletedList. DrawSurface is the invalidated causing a repaint.

Redo

When AnUndoState is usRedo then the DrawObject is removed from ADrawSurfaces DrawObjects, and SelectedObjects lists. The DrawObject is then Added to the DeletedList. DrawSurface is the invalidated causing a repaint.


MoveList

MoveList is used to store all the Drawobjects that moved in a particular move operation.  MoveLIst is created in the Create constructor of this UndoObject and is destroyed in the Destroy destructor.


dx

DX stores the distance the objects moved in the X axis.


dy

DX stores the distance the objects moved in the X axis.


Create

constructor Create (  AnObjectList  :  TList  ;

                                  ADX  ,  ADY  :  Integer  )  ;  virtual  ;

This constructor calls inherited Create passing nil as the parameter since we are moving many objects the DrawObject field is not used.  MoveList is created at this point.

All the objects stroed in AnObject list are copied to the MoveList. The positions of the objects in MoveList will be used later when Undo is called with usUndo or usRedo.


Destroy

destructor Destroy  ;  override  ;

Destroy calls the Inherited Destroy and then destroys the MoveL.st created in the create constructor.


Undo

procedure Undo (  ADrawSurface  :  TDrawSurface  ;

                              AnUndoState  :  TUndoState  )  ;  override  ;

TUndoMove.Undo simply goes through each DrawObject in Movelist calling its Undo method passing ADrawSurface and AnUndoState. The default TDrawObject.Undo checks the type of this UndoObject and calls different Undo methods depending on this type.


x

X store the X coordinate of the Point that was added to this DrawObject.


y

Y store the Y coordinate of the Point that was added to this DrawObject.


Handle

Handle stores the index of the handle that was added to the list of points.


Create

constructor Create (  ADrawObject  :  TDrawObject  ;

                                  AnX  ,  Ay  :  Integer  ;

                                  AHandle  :  Integer  )  ;  virtual  ;

This constructor calls the inherited constructor passing ADrawObject.  X is set to AnX, Y is set to AY and AHandle is set to the Handle thiat has been added.


Align

Align  ;

This property has been exposed in its super class TMoveablePanel therefore it does not need ot be exposed here at the moment. Set align to value you require.


Color

Color  ;

This property has been exposed in its super class TMoveablePanel therefore it does not need ot be exposed here at the moment. Set color to value you require.


FxScale

FScale is the scale part of the matrix and stores the X scale value.

This value is set in conjunction with the other values stored in this object to produve a matrix which can be used to transform your DrawObjects


FyScale

FScale is the scale part of the matrix and stores the Y scale value.

This value is set in conjunction with the other values stored in this object to produve a matrix which can be used to transform your DrawObjects


FxSkew

FSkew is the skew part of the matrix and stores the X skew value.

This value is set in conjunction with the other values stored in this object to produve a matrix which can be used to transform your DrawObjects


FySkew

FSkew is the scale part of the matrix and stores the Y skew value.

This value is set in conjunction with the other values stored in this object to produve a matrix which can be used to transform your DrawObjects


FxOffSet

FxOffSet is the offset part of the matrix and stores the X offset value.

This value is set in conjunction with the other values stored in this object to produve a matrix which can be used to transform your DrawObjects


FyOffset

FyOffset is the offset part of the matrix and stores the Y offset value.

This value is set in conjunction with the other values stored in this object to produve a matrix which can be used to transform your DrawObjects


Create

constructor Create (  AnOwner  :  TComponent  )  ;  virtual  ;

This constructor creates the Transform by calling the inherited Create constructor and then setting all the default values for xSkew, ySkew, xScale, yScale, xOffSet, yOffSet by calling SetupTransForm.


SetupTransform

procedure SetupTransform  ;  virtual  ;

Call this helper routine to set all the Transform matrices to default values.The default values are

FxScale  := 1.0 ;

FyScale  := 1.0 ;

FxSkew   := 0.0 ;

FySkew   := 0.0 ;

FxOffSet := 0.0 ;

FyOffset := 0.0 ;


xScale

xScale  :  Real  read  FxScale  write  FxScale  ;

xScale is normaly set to one,  set this to another value to scale an object in the Y axis.

Set xScale and yScale when you wish to scale the draw object.  Call ApplyTransform with Transform structure to transform the object.  You will need to set the WindowOrgEx before calling this routine.


yScale

yScale  :  Real  read  FyScale  write  FyScale  ;

yScale is normaly set to one,  set this to another value to scale an object in the Y axis.

Set xScale and yScale when you wish to scale the draw object.  Call ApplyTransform with Transform structure to transform the object.  You will need to set the WindowOrgEx before calling this routine.


xSkew

xSkew  :  Real  read  FxSkew  write  FxSkew  ;

xSkew is normaly set to zero,  set this to another value to skew an object in the X direction.

Set xSkew and ySkew when you wish to skew the draw object.  Call ApplyTransform with Transform structure to transform the object.  You will need to set the WindowOrgEx before calling this routine.


ySkew

ySkew  :  Real  read  FySkew  write  FySkew  ;

ySkew is normaly set to zero,  set this to another value to skew an object in the Y direction.

Set xSkew and ySkew when you wish to skew the draw object.  Call ApplyTransform with Transform structure to transform the object.  You will need to set the WindowOrgEx before calling this routine.


xOffSet

xOffSet  :  Real  read  FxOffSet  write  FxOffSet  ;

xOffset is normaly set to zero,  set this to another value to offset an object in the X direction.

Set xOffSet and yOffset when you wish to move the draw object.  Call ApplyTransform with Transform structure to transform the object.  You will need to set the WindowOrgEx before calling this routine.

You wont normally need to change this value since Drawsurface normally handles offsetting automatically.


yOffset

yOffset  :  Real  read  FyOffset  write  FyOffset  ;

yOffset is normaly set to zero,  set this to another value to offset an object in the Y direction.

Set xOffSet and yOffset when you wish to move the draw object.  Call ApplyTransform with Transform structure to transform the object.  You will need to set the WindowOrgEx before calling this routine.

You wont normally need to change this value since Drawsurface normally handles offsetting automatically.


FOnRemove

This event is set to point to the UnplugObject method in TTool. UnplugObject is called when the object is deleted and sets TTool.DrawObject to nil.  This only occurs in design state ie when csDesigning in ComponentState is true.


Parent

The parent property is set by the SetupDrawObject method or whenever the DrawObjects parent needs to be changed. A DrawObjects parent is always a TDrawSurface or a decendent of.


FEffectTool

FEffectTool is used to determine what happens affter an object is created. If this is true then the default AfterCreate method looks for the pointer tool. If there is a pointer tool in your application then pointer tool is set to being down = true, the previous tool is set to down = false.  This functionality allows the user to set whichever tool they want to be effected by overriding the AfterCreateMethod.


FTransForm

Stores the Ttransform object created in the create constructor.


ReadState

procedure ReadState (  Reader  :  TReader  )  ;  override  ;

Reads the DrawObject structure.


WriteState

procedure WriteState (  Writer  :  TWriter  )  ;  override  ;

Writes the Transform structure.  All properties of DrawObjects are streamed from disk when you call LoadDrawObjects.


GetBounds

procedure GetBounds  :  TRect  ;  virtual  ;

Used by the Bounds property to return the bounds stored in FBounds.


ToolChanged

procedure ToolChanged (  ATool  :  TTool  )  ;  dynamic  ;

ToolChanged is called by the DrawSurface engine whenever one of the tools in your application is changed.  ie  You click on the pointer too,  ATool is set to the tool just selected,  in this case the Pointer tool.


SnapToGrid

procedure SnapToGrid (  AHandle  :  Integer  ;

                                         AGrid  :  TPoint  )  ;  dynamic  ;

All objects snap to the given grid in their DrawSurface.  This routine is to be used when an object is created with no grid,  and then a grid is  turned on.  Snapp to Grid will automatically snap the object to the grid when the Object is moved.

Not implemented in this version.


CalculateBounds

procedure CalculateBounds  :  TRect  ;  virtual  ;

Complex objects such as Bezier curves or a Superlines use this routine to calculate their bounds.  The default return of this routine is Bounds.  Override this to calculate more complex bounds.


SetObjectX

procedure SetObjectX (  AnInteger  :  Integer  )  ;  virtual  ;

Called by the ObjectX property to move the Drawobject to the given X coordinate in AnInteger.  This method automatically Invalidates the object.


SetObjectY

procedure SetObjectY (  AnInteger  :  Integer  )  ;  virtual  ;

Called by the ObjectY property to move the Drawobject to the given Y coordinate in AnInteger. This method automatically Invalidates the object.


GetObjectX

function GetObjectX  :  Integer  ;  virtual  ;

Called by the ObjectX property to return the Drawobjects X coordinate.


GetObjectY

function GetObjectY  :  Integer  ;  virtual  ;

Called by the ObjectY property to return the Drawobjects Y coordinate.


SetWidth

procedure SetWidth (  AnInteger  :  Integer  )  ;  virtual  ;

Called by the Width property to size the Drawobject to the given width in AnInteger. This method automatically Invalidates the object.


SetHeight

procedure SetHeight (  AnInteger  :  Integer  )  ;  virtual  ;

Called by the Height property to size the Drawobject to the given height in AnInteger. This method automatically Invalidates the object.


GetWidth

function GetWidth  :  Integer  ;  virtual  ;

Called by property Width to return the objects width.  Calculated by Bounds.Right - Bounds.Left.


GetHeight

function GetHeight  :  Integer  ;  virtual  ;

Called by property Height to return the objects height.  Calculated by Bounds.Bottom - Bounds.Top.


GetHandleRect

function GetHandleRect (  X  ,  Y  :  Integer  )  :  TRect  ;  virtual  ;

This method return a rect with dimensions  width = 2 * HalfHandle, height  = 2 * HalfHandle,  with the Top,  Left coords of the rect set to X, Y.


GetHandleRectPT

function GetHandleRectPT (  ADrawPoint  :  TDrawPoint  )  :  TRect  ;

This method return a rect with dimensions  width = 2 * HalfHandle, height  = 2 * HalfHandle,  with the Top,  Left coords of the rect set to the Point.X, Point.Y coordinates in the passed ADrawPoint structure.


DragPoint

This point is set to the current position of the mouse,  whilst a drag operation is in action.  ie The TFreeHand tool uses this point to note the point every time it changes.


Created

Set to true if the object has been setup properly.  Not Implemented in Version 1.


ToolType

ToolType contains the class of the Tool which created this object.


FBounds

Stores the Bounds of the object.


MotherObject

MotherObject points to the DrawObject which this object is created from.  All DrawObjects have a MotherObject.  MotherObject is the component which is dropped from the palette,  it contains all the default values of the DrawObjects that will be created from it.

Use a Tool


Create

constructor Create (  AnOwner  :  TComponent  )  ;  override  ;

Sets all defualts,  creates a TTransform structure,  sets half handle to 3,  sets the parent.  Inserts self in to the MotherObjects list if self is a mother object.


Destroy

destructor Destroy  ;  override  ;

Removes self from the MotherObjects list if self is a mother object.


AreaSelect

function AreaSelect (  ARect  :  TRect  ;

                                    AShift  :  TShiftState  )  :  Boolean  ;  virtual  ;

Called by the DrawSurface engine when an area is selected.  ARect is the Rect that has been selected Ashift is the state of the shift/alt key etc.


Select

procedure Select (  ADrawSurface  :  TDrawSurface  ;

                               AnOnOff  :  Boolean  ;

                               AHandle  :  Integer  )  ;  virtual  ;

Called by the DrawSurface  engine when the user clicks on the object.  ADrawSurface is set to the DrawSurface the object is in.  AnOnOff is the select status, and Ahandle is the index of the handle selected.


SelectHandle

procedure SelectHandle (  ADrawSurface  :  TDrawSurface  ;

                                           AnOnOff  :  Boolean  ;

                                           AHandle  :  Integer  )  ;  virtual  ;

Called by the DrawSurface engine when the user clicks on the object.  ADrawSurface is set to the DrawSurface the object is in.  AnOnOff is the select status, and Ahandle is the index of the handle selected.


Paint

procedure Paint (  ASender  :  TObject  ;

                              ACanvas  :  TCanvas  )  ;  virtual  ;

This improtant method is called by PaintDrawObjects in the DrawSurface via PaintObject in the DrawObject.  Asender is the DrawSurface and ACanvas is the DrawSurfaces Canvas.  It is usually possible to call Oaint with a value of nil since the object will then search for the propper DrawSurface.


SetCanvas

procedure SetCanvas (  ACanvas  :  TCanvas  )  ;  virtual  ;

SetCanvas is called byPaintObject.  Override this method to setup the canvas. If you use this method then you will may need to override ResetCanvas also to undo the changes you made here.


SetFencingCanvas

procedure SetFencingCanvas (  ACanvas  :  TCanvas  )  ;  virtual  ;

Called by the DrawSurface to setup the canvas for fencing,  ie Sets the Pen.Mode to NotXOr and the Rop2 to a similar value.


PaintObject

procedure PaintObject (  ASender  :  TObject  ;

                                        ACanvas  :  TCanvas  )  ;  virtual  ;

Called by the DrawSurface.  Calls SetCanvas, Paint, and  finally ResetCanvas. SetCanvas normally and ResetCanvas normally do nothing.  Override these methods if you need complex Canvas handling.  DrawObjects in the DKStDraw unit uses these methods.


ResetCanvas

procedure ResetCanvas (  ACanvas  :  TCanvas  )  ;  virtual  ;

Called by the PaintObject. SetCanvas normally does nothing.  Override this method if you need complex Canvas handling.  DrawObjects in the DKStDraw unit use this method.


HitTest

function HitTest (  X  ,  Y  :  Integer  )  :  Integer  ;  virtual  ;

HitTest is called by PointerIn every time the mouse moves over the DrawSurface.  X and Y are client mouse coordinates.


GetHandle

function GetHandle (  X  ,  Y  :  Integer  )  :  Integer  ;  virtual  ;

Called by HitTest, with X, Y set to the client mouse coordinates, to return the handle number of the handle the mouse is over. TDrawObject  returns Result := 0..8.  Zero is used by the DrawSurface to determine a point on the object but not on a handle.  1, 3, 5, 7 are the 4 corners of the Bounds and 2,4,6,8 are the mid points of the lines of the Bounds.

Override this method for complex draw structures.


InvalidateObject

procedure InvalidateObject (  ADrawSurface  :  TDrawSurface  ;

                                               EraseFirst  :  Boolean  )  ;  virtual  ;

InvalidateObject,  invalidates the object in the given ADrawSurface.  EraseFirst determines whether the background within the bounds of the object is erased before the object is drawn.  If ADrawSurface is nil InvalidateObject searches for the appropriate DrawSurface.  For efficency of speed it is best to pass the DrawSurface to this method.


CalcRect

procedure CalcRect (  dx  ,  dy  :  integer  ;

                                    var  ARect  :  TRect  ;

                                    AHandle  :  Integer  )  ;  virtual  ;

CalcRect takes the value of DX, DY which are stored in the DrawSurface, the Bounds of the draw object in Arect, and the   handle which is being stretched in Ahandle.  The Default CalcRect calculates the a Stretched rectangle given the dx, dy, rect and handle. CalcRect is called by StretchFence.


StretchFence

procedure StretchFence (  ADrawSurface  :  TDrawSurface  ;

                                           AHandle  :  Integer  ;

                                           dx  ,  dy  :  Integer  ;

                                           AFenceType  :  TFenceType  )  ;  virtual  ;

StretchFence takes the DrawSurface in ADrawSurface,  the handle which is being stretched in AHandle,  the value of DX, DY which are stored in the DrawSurface, and the FenceType either ftFence or ftFenceBetter.  the default StretchFence calls CalcRect passing the appropriate values including the Bounds of the DrawObject, then calls Fence to perform the fencing on the DrawSurface.  AFenceType is calculated by the DrawSurface according to the amount of time passed between a click on the obect and a mouse move.  The time in ticks is stored in FenceInterval in DrawSuraface, this can be set at design time and Default to 250 ticks. Override Stretchfence to perform complictaed stretches. TSuperline overrides this method.


Fence

procedure Fence (   ADrawSurface  :  TDrawSurface  ;

                                ABounds  :  TRect  ;

                                AHandle  :  Integer  ;

                                dx  ,  dy  :  Integer  ;

                                AFenceType  :  TFenceType  )  ;  virtual  ;

Fence performs the act of Fencing by drawing on the DrawSurface, ADrawSurface. ABounds is the bounds that is culculated by CalcRect and passed to Fence by StretchFence. Ahandle is the current handle being stretched, dx and dy are the curent values of dx, dy calculated by the DrawSurface and AFenceType is the current value of TFenceType calculated in the DrawSurface. The default Fence,  fences displays the DrawObjects rectangular handles. Override this method to perform complicated fences.  TSuperline overrides this method.


Resize

procedure Resize (  dx  ,  dy  :  integer  ;

                                AHandle  :  Integer  ;

                                DoInvalidate  :  boolean  ;

                                DoResize  :  boolean  )  ;  virtual  ;

Resize is called by the DrawSurface after a stretching or moving operation has been applied to the DrawObject. Ahandle is the current handle being stretched, dx and dy are the curent values of dx, dy calculated by the DrawSurface,  doInvalidate determines if the DrawObject should be invalidated after the Resize opperation and DoResize determines if the object shoul be resized.  The default Resize resizes the Bounds of the DrawObject. Override this method if you need more complex resizing.


DrawHandle

procedure DrawHandle (  ACanvas  :  TCanvas  ;

                                         X  ,  Y  :  Integer  )  ;  virtual  ;

DrawHandle by default draws a handle at X, Y on the given Canvas, Acanvas.  The handle is drawn by inverting a rect calculated using the values of Halfandle stored in the DrawObject. This method can be overridden to drawhandles in an other way ie to draw color handles.


DrawHandleFromPoint

procedure DrawHandleFromPoint (  ACanvas  :  TCanvas  ;

                                                          ADrawPoint  :  TDrawPoint  )  ;  virtual  ;

DrawHandleFromPoint  takes ACanvas on which the Handle will be drawn and ADrawPoint object.  The handle is drawn at the coordinates stored in ADrawPoint.Point by a call to DrawHandle.


DrawHandles

procedure DrawHandles (  ADrawSurface  :  TDrawSurface  ;

                                           ARect  :  TRect  ;

                                           AHandle  :  Integer  )  ;  virtual  ;

DrawHandles draws all the DrawObjects handles by calls to DrawHandle, on the DrawSurface,  ADrawSurface.  The default DrawHandles draws the handles around the given rect,  ARect. Override this method to draw more complex handle patterns.


DrawStretchHandles

procedure DrawStretchHandles (  ADrawSurface  :  TDrawSurface  ;

                                                      ARect  :  TRect  ;

                                                      AHandle  :  Integer  )  ;  virtual  ;

Draw StretchHandles draws all the DrawObjects handles by calls to DrawHandle, on the DrawSurface,  ADrawSurface.  The default DrawStretchHandles draws the handles around the given rect,  ARect. Override this method to draw more complex handle patterns. DrawStretchHandles calls DrawHandles after setting up the Canvas in ADrawSurface for NotXor operations.  All Rop settings are reset after calls to this method.


MouseDrag

procedure MouseDrag (  ADrawSurface  :  TDrawSurface  ;

                                        APoint  :  TPoint  ;

                                        AHandle  :  Integer  )  :  Boolean  ;  virtual  ;

MouseDrag is called after a click on a handle and a mouse move.  ADrawSurface is the DrawSurface the DrawObject is in, Apoint is the coordinates of the mouser pointer in ADrawsurface client coordinates, and Ahandle is the handle being stretched.


MouseUp

procedure MouseUp (  ADrawSurface  :  TDrawSurface  ;

                                     AButton  :  TMouseButton  ;

                                     AShiftState  :  TShiftState  ;

                                     AnX  :  Integer  ;

                                     AY  :  Integer  )  ;  dynamic  ;

MouseUp is called after all default MouseUp processing in the DrawSurface,  ADrawSurface.  AButton is the Button just realeased,  AShitState is the state of the Alt/Shift button, and AnX, AY is the client coordinates of the mouse pointer at the time of realease.


MouseDown

procedure MouseDown (  ADrawSurface  :  TDrawSurface  ;

                                         AButton  :  TMouseButton  ;

                                         AShiftState  :  TShiftState  ;

                                         AnX  :  Integer  ;

                                         AY  :  Integer  )  ;  dynamic  ;

MouseDown is called after all default MouseDown processing in the DrawSurface,  ADrawSurface.  AButton is the Button just pressed,  AShitState is the state of the Alt/Shift button, and AnX, AY is the client coordinates of the mouse pointer just pressed.


SetupDrawObject

procedure SetupDrawObject ( AParent  :  TComponent  ;

                                                ACanvas  :  TCanvas  ;

                                                ASetupType  :  Integer  ;

                                                AMotherObject  :  TDrawObject  )  ;  virtual  ;

SetupDrawObject is called once after the DrawObject is created, once after the DrawObject is sized, and once after the DrawObject is streamed in. Asetup type is set to either stSetup, stPostResize, or stLoaded to determine this difference.  AParent is the DrawSurface the DrawObject is in,  ACanvas is the Canvas of that DrawSurface and AMotherObject is the DrawObject which created this DrawObject or is the MotherObject of the same type as Self.

The default SetupDrawObject sets the DrawObjects MotherObject and sets Parent to AParent. It also sets the DrawObjects EffectTool property to the MotherObjects EffectToolProperty.

Override this method to perform further setups.  Inherited SetupDrawObject must be called otherwise errors will occur.


AddPart

procedure AddPart ( ADrawSurface  :  TDrawSurface  ;

                                 APoint  :  TPoint  )  ;  virtual  ;

AddPart is called  by ADrawSurface.CreateDrawObject if ADrawSurface detects that a new part should be added to this DrawObject.  Apoint is set to the point of the part to be added.


PartHandle

function PartHandle  :  Integer  ;  virtual  ;

PartHandle should return the index of the part that the user wishes to add to the DrawObject. The default return is 1. ie TSuperline returns the index of the selected handle.


Undo

procedure Undo (  AnUndoObject  :  TUndoObject  ;

                              AnUndoState  :  TUndoState  ;

                              ADrawSurface  :  TDrawSurface  )  ;  virtual  ;

Undo is called in response to an Undo event in the DrawSurface, ADrawSurface. AnUndoObject is the current undo object, AnUndoState is set to either usUndo or usRedo according to the undo state of the ADrawSurface. The default Undo undoes or redoes the effects of any move or stretch on a rectangular object. Override this method and create new TUndoObjects to handle more complex Undo tasks.


PostUndo

procedure PostUndo (  AnUndoObject  :  TUndoObject  )  ;  virtual  ;

PostUndo posts an undo in AnUndoObject whenever an Undoable action happens. By default this is called whenever the DrawObject is stretched or moved.  DrawSurface handles the undoing of multiple move automatically. If you have an action you wish to Undo then create a new UndoObject class and Post this class at the appropriate times,  all undoing and redoing will then be automatic.


AfterCreate

procedure AfterCreate (  ADrawSurface  :  TDrawSurface  )  ;  virtual  ;

After create is called by DrawSurface, ADrawSurface after the DrawObject has been created. AfterCreate looks at the property EffectToolBox to determine if it should set the PointerTool speedbutton to down.  The user can override this method to do other things when the DrawBject is created.  You should call the Inherited AfterCreate method otherwise tool handling will be effected.


AfterAddPart

procedure AfterAddPart (  ADrawSurface  :  TDrawSurface  ;

                                          ADrawObject  :  TDrawObject  )  ;  virtual  ;

AfterAddPart is called after a part has been added to the DrawObject by the PartAdded method in the DrawSurface, ADrawSurface. The default method does nothing but can be overriden.


GetCursor

function GetCursor (  AHandle  :  Integer  )  :  TCursor  ;  virtual  ;

GetCursor returns by default the crDefault cursor.  Ahandle is set to the current handle. Override this method to return different cursors as a function of AHandle.


GetInvalidBounds

function GetInvalidBounds  :  TRect  ; virtual  ;

GetInvalidBounds returns the Rect which is invalid in DrawObject. Bounds holds the rect that the DrawObject is in,  however in situations where the DrawObject will draw outside its Bounds, ie when the thikness of a line causes the object to be painted outside the bounds, this function will return the bounds which should be invaildtated. This method is used by Invalidate object.


SetParentSurface

procedure SetParentSurface (  ADrawSurface  :  TDrawSurface  )  ;  virtual  ;

SetParentSurface is called by the Parent propety whenever a new parent is being set.


GetParentSurface

function GetParentSurface  :  TDrawSurface  ;  virtual  ;

GetParentSurface is called by the Parent propety whenever the parent is required. It returns the Parent surface of the DrawObject


ApplyTransform

ApplyTransform (  APoints  :  TList  )  ;  virtual  ;

ApplyTransForm is called after the Transform object has been setup with a transform operation.  This applys that transformation to the object. The user is required to set the origins of the DrawSurface with SetWindowOrgEx before calling this method. Future realeases ofDrawKit will implement this properly.


TransformPoint

procedure TransformPoint (  ATransform  :  TTransForm  ;

                                              ADrawPoint  :  TDrawPoint  )  ;  virtual  ;

TransformPoint is called after the Transform object has been setup with a transform operation.  This applys that transformation to the DrawPoint ADrawPoint. The user is required to set the origins of the DrawSurface with SetWindowOrgEx before calling this method. Future realeases of DrawKit will implement this properly.


Rotate

procedure Rotate (  AnAngle  :  Integer  )  ;  virtual  ;

Given an angle the DrawObject will be rotated around the Origin of the parent DrawSurface.


Scale

procedure Scale (  AnXScale  :  Real  ;

                               AYScale  :  Real  )  ;  virtual  ;

Given an AnXScale and AYScale the DrawObject will be scaled around the Origin of the parent DrawSurface.


Translate

procedure Translate (  ADX  :  Integer  ;

                                     ADY  :  Integer  )  ;  virtual  ;

Given an ADX and ADY the DrawObject will be move around the Origin of the parent DrawSurface.  You should not need to use this  procedure since you can set the DrawObjects propertys ObjectX and ObjectY to perform this opperation.


Skew

procedure Skew (  AnXSkew  :  Real  ;

              	  AYSkew  :  Real  )  ;  virtual  ;

Given an AnXSkew and AYSkew the DrawObject will be skewed around the Origin of the parent DrawSurface.


OnRemove

OnRemove  :  TNotifyEvent  read  FOnRemove  write  FOnRemove  ;

OnRemove is a event posted when the DrawObject is destroyed.


Bounds

Bounds  :  TRect  read  GetBounds  write  FBounds  ;

Bounds is the the Rect containing the object.  this property is manipulated by the Resize method, the ObjectX, ObjectY, Width and Height propertys and used by anything that that needs to know the bounds of the DrawObject.  Propertys cannot be passed as variable parameters so FBounds has been made public for you to use also.


InvalidBounds

InvalidBounds  :  TRect  read  GetInvalidBounds  ;

Invalid bounds returns the value calculated by GetInvalidBounds. See GetInvalidBounds for a more indepth description.


ParentSurface

ParentSurface  :  TDrawSurface  read  GetParentSurface  write  SetParentSurface  ;

This property returns and sets the FParentSurface private field.


ObjectX

ObjectX  :  Integer  read  GetObjectX  write  SetObjectX  ;

The ObjectX property sets the X coordinate and Invalidates the DrawObject.


ObjectY

ObjectY  :  Integer  read  GetObjectY  write  SetObjectY  ;

The ObjectY property sets the Y coordinate and Invalidates the DrawObject.


Width

Width  :  Integer  read  GetWidth  write  SetWidth  ;

The Width property sets the width and Invalidates the DrawObject.


Height

Height  :  Integer  read  GetHeight  write  SetHeight  ;

The Height property sets the height and Invalidates the DrawObject.


Transform

Transform  :  TTransform  read  FTransForm  write  FTransform  ;

The Transform reads and writes the FTransform property.


FHalfHandle

FHalfHandle is half the handle size and by default is set to 3.


HalfWidth

Halfwidth is used to speed calculation when fencing the handles.


HalfHeight

HalfHeigth is used to speed calculation when fencing the handles.


FPaint

This stores a paint event. This event is not called in this version of DrawKit


FPaintHandles

This store a paint event. This event is not called in this version of DrawKit


FSelected

Fselected stores the selection status of the DrawObjcet.


FStretchFence


FInvalidBounds


FParentSurface


FChangeObjects


HalfHandle

HalfHandle  :  Integer  read  FHalfHandle  write  FHalfHandle  default  3  ;

HalfHandle is half the width and height of a handle


OnPaint

OnPaint  :  TPaintObjectEvent  read  FPaint  write  FPaint  ;

OnPaint is an event in the MotherObject that gets called when one of the objects which it created gets painted.


OnPaintHandles

OnPaintHandles  :  TPaintObjectEvent  read  FPaintHandles  write  FPaintHandles  ;

This section incomplete in this version of DrawKit help files.


OnStretchFence

OnStretchFence  :  TStretchFenceEvent  read  FStretchFence  write  FStretchFence  ;

This section incomplete in this version of DrawKit help files.


Selected

Selected  :  Boolean  read  FSelected  write  FSelected  ;

The selected property store the selection status of the DrawObject.


EffectTool

EffectTool  :  Boolean  read  FEffectTool  write  FEffectTool  ;

EffectTool is used to determine what happens affter an object is created. If this is true then the default AfterCreate method looks for the pointer tool. If there is a pointer tool in your application then pointer tool is set to being down = true, the previous tool is set to down = false.  This functionality allows the user to set whichever tool they want to be effected by overriding the AfterCreateMethod.


ChangeObjects

ChangeObjects  :  Boolean  read  FChangeObjects  write  FChangeObjects  ;

ChangeObjects when set to true causes all the DrawObjects of this type that are not MotherObjects to change there settings when the MotherObjects settings are changed. ie If we change the LineColor in a TLineObject Mother object  and this is true then all the LineObjects in all the DrawSurfaces will be set to have the same line color.


StoredDX


StoredDY


CalcRect

procedure CalcRect (  dx  ,  dy  :  integer  ;

                                    var  ARect  :  TRect  ;

                                    AHandle  :  Integer  )  ;  override  ;


DrawHandles

procedure DrawHandles (  ADrawSurface  :  TDrawSurface  ;

                                           ARect  :  TRect  ;

                                           AHandle  :  Integer  )  ;  override  ;


Fence

procedure Fence (  ADrawSurface  :  TDrawSurface  ;

                               ABounds  :  TRect  ;

                               AHandle  :  Integer  ;

                               dx  ,  dy  :  Integer  ;

                               AFenceType  :  TFenceType  )  ;  override  ;


InvalidateObject

procedure InvalidateObject (  ADrawSurface  :  TDrawSurface  ;

                                               EraseFirst  :  Boolean  )  ;  override  ;


MouseUp

procedure MouseUp (  ADrawSurface  :  TDrawSurface  ;

                                     AButton  :  TMouseButton  ;

                                     AShiftState  :  TShiftState  ;

                                     AnX  :  Integer  ;

                                     AY  :  Integer  )  ;  override  ;


Picture

Picture stores the picture that the picture will then display whenever required. Picture is either a BMP, WMF or ICON file.


Ext

Ext stores the file extension of the type of Picture stored in Picture. Exr is either BMP, WMF or ICO


ReadState

procedure ReadState (  Reader  :  TReader  )  ;  override  ;

Calls inherited ReadState to read in the DrawObject then using Reader ReadState Reads in Ext.  Picture is created here and passed to LoadFromReader along with Reader and Ext. LoadFromReader reads in the Picture.


WriteState

procedure WriteState (  Writer  :  TWriter  )  ;  override  ;

Calls inherited WriteState to write out the DrawObject then using Writer WriteState writes out Ext.  Ext is found by calling GetExt( Ext ).  SaveToWriter writes out the Picture.


GetExt

function GetExt (  AGraphic  :  TGraphic  )  :  String3  ;  virtual  ;

Given AGraphic GetExt returns the file extension of this graphic type. ie if AGraphic is a bitmap then GetExt  returns BMP, if AGraphic is a matafile then GetExt reurns WMF


SetCanvas

procedure SetCanvas (  ACanvas  :  TCanvas  )  ;  override  ;

SetRop2( Handle, R2_COPYPEN ) ;

Pen.Mode := pmCopy ;


LoadCreate

constructor LoadCreate (  AnOwner  :  TComponent  ;

                                          AFileName  :  string  )  ;  virtual  ;

LoadCreate calls Inherited Create passing AnOwner. Picture is created by Picture := TPicture.Create and then is loaded by PIcture.LoadFromFile( AFileName ).


Create

constructor Create (  AnOwner  :  TComponent  )  ;  override  ;

Calls Inherited Create passing AnOwner.

This constructor does not create the Picture, the picture is create in the DrawSurface engine and is set in the LoadDrawObjects method.


Destroy

destructor Destroy  ;  override  ;

Calls Picture.Free to free up the picture.


SaveToFile

procedure SaveToFile (  const  AFileName  :  String  )  ;  dynamic  ;

Given AFileName SaveToFile saves the  Picture in Picture to the File in File in AFileName.


Paint

procedure Paint (  ASender  :  TObject  ;

                             ACanvas  :  TCanvas  )  ;  override  ;

Paints the Bitmap or MetaFile to the Canvas  in ACanvas.


CalculateBounds

function CalculateBounds : TRect ; override ;

Returns the bounds of the Bitmap or MetaFile.


FCurveBefore

FCurveBefore : Boolean ;

Stores the status of property CurveBefore. If this is true then any bezier calculations must take into account a curve in the line before this point.  TSuperline automatically handles this.


FCurveAfter

FCurveAfter : Boolean ;

Stores the status of property CurveAfter. If this is true then any bezier calculations must take into account a curve in the line after this point.  TSuperline automatically handles this.


FSameLength

FSameLength : Boolean ;

Stores the status of property SameLength. If this is true then any handle fencing calculations must take into account, and change handle positions relative to one another.  TSuperline automatically handles this.


FSameAngle

FSameAngle : Boolean ;

Stores the status of property SameAngle. If this is true then any handle fencing calculations must take into account, and change handle positions relative to one another.  Setting the angle between handles to 180 degrees.


FStatus

FStatus : Integer ;

Stores the status of property Status.  This is the selection status of the DrawPoint


FPointType

This is for use by the User and is not used by DrawSurface.


Point

The X and Y coordinates of the DrawPoint are stored in Point


Handles

Handles : T2PointArray

DrawPoints have essentially 3 handles Point + Handles.  Handles is a T2PointArry which is T2PointArray = array[ 0..1 ] of Char. These handles are used for fencing beziers or any other fencing that the user may need.


Create

constructor Create (  APoint  :  TPoint  )  ;  virtual  ;

Sets Point to APoint.


CreateCopy

constructor CreateCopy (  ADrawPoint  :  TDrawPoint  )  ;  virtual  ;

CreateCopy will create the DrawPoint as a copy of ADrawPoint.  Copying all ADrawPoints fields.


ReadState

procedure ReadState (  AReader  :  TReader  )  ;  virtual  ;

Reads in the DrawPoint, from the Reader in AReader.


WriteState

procedure WriteState (  AWriter  :  TWriter  )  ;  virtual  ;

Writes the DrawPoint to the give Writer in AWriter.


Status

Status  :  Integer  read  FStatus  write  FStatus  ;

Status is the selection status of the DrawPoint


PointType

PointType  :  Integer  read  FPointType  write  FPointType  ;

Not implemented in this version.


CurveBefore

CurveBefore  :  Boolean  read  FCurveBefore  write  FCurveBefore  ;

CurveBefore determines if there is a bezier curve before the DrawPoint.


CurveAfter

CurveAfter  :  Boolean  read  FCurveAfter  write  FCurveAfter  ;

CurveBefore determines if there is a bezier curve before the DrawPoint.


SameLength

SameLength  :  Boolean  read  FSameLength  write  FSameLength  ;

SameLength determines if the handles will stay the same distance away from each other as they are stretched appart.  If same length is true then Same angle must be true also otherwise the effecs will be upredictable.


SameAngle

SameAngle  :  Boolean  read  FSameAngle  write  FSameAngle  ;

SameAngle determines if the angle between the two handles is 180 degrees or not.  In this version this value can only be set along with SameLength.


SetupFlag


Create

constructor Create (  AnOwner  :  TComponent  )  ;  override  ;


CursorID

CursorId stores the cursor for this tool.


FOnGetDrawClass


FDrawClass

FDrawClass : TDrawClass

Not Used


FToolClick

FToolClick : TToolClickEvent

Used Internally


FToolCursor

FToolCursor : TCursor

Stores the Cursor image that will be used by this tool during DrawObject creation.


FCursorName

FCursorName : String

The name of the cursor resource. This is set aitomatically when the DrawObject is set.


FInformClick

FInformClick : Boolean

FInformClick stores the InformClick propertys value. If inform click is true then all DrawObjects will be informed of the tool change by calls to their ToolChanged methods.


FEffectDistant

FEffectDistant : Boolean

FEffectDistant stores the EffectDistant property value. If EffectDistant is true then all tools with the same group index even tools not in the same panel or form will effectively be part of the same radio group. If one of these tools is pressed then all tools with the sam group index will be wffwcted.


FDrawObject

FDrawObject : TDrawObject

FDrawObject stores the FDrawObject property value. FDrawObject is an instance of the same type of DrawObject that this tool will create on any DrawSurface.


SetParent

procedure SetParent (  AParent  :  TWinControl  )  ;  override  ;

Setparent gets called when the tool is created or read in from a stream.  It sets various values that need to be set.  You wont normaly need to override this.


UnplugObject

procedure UnplugObject (  ASender  :  TObject  )  ;  virtual  ;

Not used.


Create

constructor Create (  AnOwner  :  TComponent  )  ;  override  ;

Calls Inherited Create and sets the variables below.

GroupIndex := 1 ;

DrawObject := nil ;

FInformClick := True ;

FToolCursor := crDefault ;

FEffectDistant := True ;

This tool is then inserted into the ToolList.


Destroy

destructor Destroy  ;  override  ;

This destructor removes self from the ToolList.


ToolClick

procedure ToolClick (  ADrawSurface  :  TDrawSurface  )  ;  virtual  ;

TTool.ToolClick does nothing. To augment the Ttool functionality you must overrid this method.


Click

procedure Click  ;  override  ;

Most of the functionality of TTool happens here. TTool.Click calls ToolClick. Click then checks the InformClick method. If InformClick is true all DrawSurfaces in your application have their Tool property to this tool.

EffectDistant is then checked if EffectDistant is true then the currently.down tool is set to be un pressed and a by default the the software attempts to set pointer tool (TPointerTool) to be pressed.


CreateObject

function CreateObject (  ADrawSurface  :  TDrawSurface  ;

                                       var  AHandle  :  Integer  ;

                                       var  AnAdding  :  Boolean  ) : TDrawObject ; virtual  ;

CreateObject by default creates an object and returns the object by using the runtime type information taken from the property DrawObject. AnAdding is set to false.


ReadState

procedure ReadState (  Reader  :  TReader  )  ;  override  ;

This section not complete in this version of the help files.


SetDrawClass

procedure SetDrawClass (  ADrawClass  :  TClass  )  ;  virtual  ;

This section not complete in this version of the help files.


SetDrawObject

procedure SetDrawObject (  ADrawObject  :  TDrawObject  ) ; virtual ;

This section not complete in this version of the help files.


GetCursor

function GetCursor (  AHandle  :  Integer  )  :  TCursor  ;  virtual  ;

This section not complete in this version of the help files.


ObjectChanged

procedure ObjectChanged (  AnObject  :  TDrawObject  ;

                                              AChangeType  :  TChangeType  )  ;  virtual  ;

This section not complete in this version of the help files.


GetActiveDrawSurface

function GetActiveDrawSurface  :  TDrawSurface  ; virtual  ;

This section not complete in this version of the help files.


DrawClass

DrawClass  :  TClass  read  FDrawClass  write  SetDrawClass  ;

This section not complete in this version of the help files.


ActiveDrawSurface

ActiveDrawSurface  :  TDrawSurface  read  GetActiveDrawSurface  ;

This section not complete in this version of the help files.


OnGetDrawClass

OnGetDrawClass  :  TOnGetDrawClass  read  FOnGetDrawClass  write  FOnGetDrawClass  ;

This section not complete in this version of the help files.


GroupIndex

GroupIndex  default  1  ;

This section not complete in this version of the help files.


DrawObject

DrawObject  :  TDrawObject  read  FDrawObject  write  SetDrawObject  ;

This section not complete in this version of the help files.


OnToolClick

OnToolClick  :  TToolClickEvent  read  FToolClick  write  FToolClick  ;

This section not complete in this version of the help files.


ToolCursor

ToolCursor  :  TCursor  read  FToolCursor  write  FToolCursor  ;

This section not complete in this version of the help files.


CursorName

CursorName  :  String  read  FCursorName  write  FCursorName  ;

This section not complete in this version of the help files.


InformClick

InformClick  :  Boolean  read  FInformClick  write  FInformClick  default  True  ;

This section not complete in this version of the help files.


EffectDistant

EffectDistant  :  Boolean  read  FEffectDistant  write  FEffectDistant  default  True  ;

This section not complete in this version of the help files.


FFenceBitMap

FFenceBitMap : TBitmap

This section not complete in this version of the help files.


Create

constructor Create (  AnOwner  :  TComponent  )  ;  override  ;

This section not complete in this version of the help files.


Destroy

destructor Destroy  ;  override  ;

This section not complete in this version of the help files.


GetFenceBitmap

function GetFenceBitmap  :  TBitmap  ; virtual  ;

This section not complete in this version of the help files.


Fence

procedure Fence (  ADrawSurface  :  TDrawSurface  ;

                               ABounds  :  TRect  ;

                               AHandle  :  Integer  ;

                               dx  ,  dy  :  Integer  ;

                               AFenceType  :  TFenceType  )  ;  override  ;

This section not complete in this version of the help files.


DrawHandles

procedure DrawHandles (  ADrawSurface  :  TDrawSurface  ;

                                           ARect  :  TRect  ;

                                           AHandle  :  Integer  )  ;  override  ;

This section not complete in this version of the help files.


FenceBitmap

FenceBitmap  :  TBitmap  read  GetFenceBitMap  write  FFenceBitmap  ;

This section not complete in this version of the help files.


Create

constructor Create (  AGrid  :  TGrid  )  ;  virtual  ;

This section not complete in this version of the help files.


Grid

This section not complete in this version of the help files.


Changed

Changed  ;  override  ;

This section not complete in this version of the help files.


Parent

This section not complete in this version of the help files.


Create

constructor Create (  AComponent  :  TComponent  )  ;  virtual  ;

This section not complete in this version of the help files.


DrawGrid

DrawGrid  ;  virtual  ;

This section not complete in this version of the help files.


InvalidateGrid

InvalidateGrid  ;  virtual  ;

This section not complete in this version of the help files.


FGridX

This section not complete in this version of the help files.


FGridY

This section not complete in this version of the help files.


FPen

This section not complete in this version of the help files.


FGridType

This section not complete in this version of the help files.


SetGridX

SetGridX (  AnX  :  Integer  )  ;

This section not complete in this version of the help files.


SetGridY

SetGridY (  AY  :  Integer  )  ;

This section not complete in this version of the help files.


SetGridPen

SetGridPen (  APen  :  TGridPen  )  ;

This section not complete in this version of the help files.


SetGridType

SetGridType (  AGridType  :  TGridType  )  ;

This section not complete in this version of the help files.


GridX

GridX  :  Integer  read  FGridX  write  SetGridX  ;

This section not complete in this version of the help files.


GridY

GridY  :  Integer  read  FGridY  write  SetGridY  ;

This section not complete in this version of the help files.


Pen

Pen  :  TGridPen  read  FPen  write  SetGridPen  ;

This section not complete in this version of the help files.


GridType

GridType  :  TGridType  read  FGridType  write  SetGridType  ;

This section not complete in this version of the help files.


LButtonDown

LButtonDown : Boolean

Stores the mouses eftbutton status over the DrawSurface.


CurrentDrawObject

CurrentDrawObject : TDrawObject

CurrentDrawObject dynamicaly stores the DrawObject the mouse is curently over.


CurrentSelected


CurrentHandle

CurrentHandle : Integer

CurrentHandle dynamically stores the handle which the mouse is currently over


OldViewPortExtents


OldWindowExtents


UndoList

UndoList : TList

UndoList stores all the undo objects for the DrawSurface. DrawObjects uses PostUndo to post any undo objects to this list.


DeletedList

Deleted list is created in the create constructor and is used to store pointers to all deleted objects. This list is used by the undo engine to undo deleted objects and recreate them.


ClickPoint

ClickPoint is set by the MouseDown method and used by any method or function that moves or resizes the DrawObjects.


dx

DX stores the current offset between the current cursor position and the click point stored in ClickPoint. This value is only set during draggin periods and therefore should not be used out with a cursor drag.


dy


FSelectionRect

FSelectionRect : TRect

DY stores the current offset between the current cursor position and the click point stored in ClickPoint. This value is only set during draggin periods and therefore should not be used out with a cursor drag.


NewObjectFlag

Used Internally.


NotedPoint

Used Internally.


FenceType

Set when FenceInterval is completed. DrawObjects may or may not respond to this mode.  However all DrawObjects supplied with DrawKit do. Simple fencing by default is a not operation single point width, black, rectangle. When FenceType is set to ftFenceBetter then all drawObjects perform shaped not operation, coloured fencing.


BitmapFencer

This section not finished in this version of the help files.


Adding

Adding : Boolean ;

Adding is set when the DrawSurface is in an adding mode. Adding is true when the user is adding to a DrawObject and false otherwise.


Selecting

Selecting : Boolean

Selecting is set when the DrawSurface is in an selecting mode. Selecting is true when the user is selecting and false otherwise.


Modified

Modified : Boolean

Modified stores the modification status of the DrawSurface this is set to true whenever any change is made to any of the objects on the form. Chages are defined currently as any stretch, move or delete modification. The user may set the modified flag for other chage if they desire.

If modified is true then on closing a DrawSurface a message box will appear requesting a save be done.


AutoScrolling

AutoScrolling : Boolean

AutoScrolling is set to true when the DrawSurface detects that a scroll outside the visible extents of the DrawSurface is being requested. It is automatically set to false in the MouseUp method.


CursorPoint

CursorPoint : TPoint

CursorPoint is set at runtime and is the current position of the cursor over the DrawSurface.


PlaceableWrapper

PlaceableWrapper : TPlaceableWrapper

PlaceableWrapper is the DrawObject which will be palced on a placing operation. This DrawObject is created in the LoadDrawObjects method when a valid placeable file is loaded and the TOpen.OpenMode is set to omPlace.


FPaint

FPaint : TPaintObjectEvent

Fpaint stores the OnPaint event for the DrawSurface. This is called every time an DrawObject is painted.on to the DrawSurface.


FTool

FTool : TTool

Store the current Tool for this DrawSurface.


FOnCreateObject

Stores the method which will get called every time a DrawObject is created.


FFenceInterval

FFenceInterval : Integer

FFenceInterval stores the interva in ticks between the MouseClick and the setting of the fence type to ftFenceBetter.


FUndoPosition

FUndoPosition : Longint

FUndoPosition stores the current undo position.


FCurrentUndoObject

FCurrentUndoObject : TUndoObect

FCurentUndoObject sores the current undo object at the current undo position.


FObjectCreation


FGetDrawObjects


FPlacing

FPlacing : Boolean

Fplacing is set when the DrawSurface is in a placing mode. This flag effects the cursor of the application


SetFenceInterval

procedure SetFenceInterval (  AnInterval  :  Integer  )  ;

Called by the property FenceInterval, to set the interval an setup the tiimer for activation.


SetPlacing

procedure SetPlacing (  APlacing  :  Boolean  )  ;

Sets the Fplacing field and changes the cursor to the cursor in the resa file with the name stored in PlaceCursor.


FenceTimer

FenceTimer : TTimer

FenceTimer is created by the DrawSurface and is used to set the FenceType field.


Paint

procedure Paint  ;  override  ;

Checks property UseGrid, if this is true then draws the grid.

The draw objects are then painted by a call to PaintDrawObjects.


PaintDrawObjects

procedure PaintDrawObjects (  ADrawSurface  :  TDrawSurface  ;

                                                  ACanvas  :  TCanvas  )  ;  virtual  ;

Painting

This method paints all the draw objects on to the canvas in ACanvas. The painting operation is optimised so only objects that are visible in the draw surface are painted.

Painting selected objects.

DrawObjects are painted first and then the selection handles are painted.

PaintDrawObjects also  handles auto scrolling.  PaintDrawObjects checks the AutoScrolling flag and handles auto scrolling by removing all fences in the correct order.


MouseDown

procedure MouseDown (  Button  :  TMouseButton  ;

                                         Shift  :  TShiftState  ;

                                         X,  Y  :  Integer  )  ;  override  ;

MouseDown handles all mouse down events, noteing the the click point in the field ClickPoint. Clickpoint is used in mouse move for dx, dy calculations. The grid is applied to the clickpoint prior to noteing the clickpoint. If the left button was pressed and and object is under the mouse at the time the LetButtonDown field is set to true.

Placing

If the Placing field is set to True then the placeable wrapper that was created in the LoadDrawObjects method will be placed by a call to PlaceWrapper at the coordinates X, Y.

Selection

If the tool stored in Tool is a TPointerTool and If ClickPoint is on a DrawObject, that is to say the click point is within the bounds or on a handle of an object and no shift key is pressed then all the selected objects are deselected by a call to DeSelectAll. If the shift key is pressed then the object under the currsor is selected and added to the SelectedObjects list, no other objects are effected. MouseDown first looks through the handles and then checks if the click point is within the bounds, this allows the user to select a handle that is under a DrawObject.

Creation

If the tool stored in the Tool property of this draw surface is not a TPointerTool but a tool which has a valid DrawObject in its Drawobject field then a new DrawObject is created. SetupDrawObject is called setting SetupType to stSetup. An undo object is posted to the undo object list with the usUndoType set to utUndoCreate.

Adding to an DrawObject

If there is a currently selected TMultiPartTool then MouseDown will not create a new object, a part is added to the current object instead. Inthis case adding is set to true.

Selection rectangle

If the the tool stored in the Tool is a TPointerTool then the SelectionRect which was created in the Create constructor. is moved to the X, Y coordinates.

MouseDown finally calls the DrawObjects MouseDown method.


MouseMove

procedure MouseMove (  Shift  :  TShiftState  ;

                                         X, Y  :  Integer  )  ;  override  ;

MouseMove handles all mouse movements over the DrawSurface.

Moving

If the CurrentHandle is set to 0 then all selected DrawObjects are fenced by a call to MoveAll. Move all calls each selected draw objects StretchFenceto stretch all fences on to the canvas, then fences are removed by calls to each DrawObjects StretchFence. Auto scrolling is handled automatically.

Stretching.

If CurrentHandle is set to any number greater than 0 then CurrentDrawObject is stretched with a call to that DrawObjects StretchFence method.  Auto scrolling is handled automatically.

Selelection Rectangle

If current handle is -1 then the SelectioRect that was placed in MouseDown will be stretched here. . Auto scrolling is handled automatically.

Cursors

Cursor display is handled automatically at this point.


MouseUp

procedure MouseUp (  Button  :  TMouseButton  ;

                                     Shift  :  TShiftState  ;

                                     X, Y  :  Integer  )  ;  override  ;

Moving

If the CurrentHandle is 0 then all selected DrawObjects are moved by a call to EndMoveAll. EndMoveAll calls each selected draw objects Resize method to move all the objects. Fencing does not move the object it only displays a fence, Resize does the work of actually moving the objects.

Stretching.

If CurrentHandle is set to any number greater than 0 then CurrentDrawObject is Resized by a call to CurrentDrawObjects resize method..

Selelection Rectangle

If current handle is -1 then the SelectionRect that was placed in MouseDown and stretched in mouse move is then removed and made invisible. The AreaSelect method is called selecting any object that has nay handle within the rectange area of the SelectionRect.  This will be augmented in future versions to allow exclusive selction, ie only selecting DrawObjects which are completely within the selection rectangle.

The current draw objects MouseUp method is then called.


GetObjectFromPoint

function GetObjectFromPoint (  X,  Y  :  Integer  ;

                                                  var  AHandle  :  Integer  ) :

                                                  TDrawObject  ;  virtual  ;

GetObjectFromPoint returns the DrawObject and Handle index in AHandle, that is at the given coordinates X, Y. It does this by calling PointerIn.


CreateDrawObjects

procedure CreateDrawObjects  :  TObjectList  ; virtual  ;

CreateDrawObjects simply creates the DrawObjects list.


DoneDrawObjects

procedure DoneDrawObjects  ;  virtual  ;

CreateDrawObjects simply frees the DrawObjects list.


Select

procedure Select (  ADrawObject  :  TDrawObject  ;

                               AnOnOff  :  Boolean  ;

                               AShift  :  TShiftState  )  ;  virtual  ;

Select contains all the selection functionality for individual objects in the DrawSurface. Select attemps to select the the draw object in ADrawObject with the selection status in AnOnOff. Shift state modifies the action of the select. If the shift key is clicked then the object is selected and no other objects are modified,  however if the the shift key is not clicke then the object is selected bu all other objects are deslected.


DeselectAll

procedure DeselectAll  ;  virtual  ;

DeselectAll deselects all the the selected objects and removes them from the the SelectedObjects list, the DrawSurface is Invalidated and repainted at this point.


AreaSelect

procedure AreaSelect (  ARect  :  TRect  ;

                                       AShift  :  TShiftState  )  ;

Area select performs selction on the give rectangular area. Currently all objects with any handle in the given area are selected. Ashift modifies the selection. If a shift key is pressed then the objects are selected if the shift key is not pressed then all objects which are not within the area and are selected are deslected.


MoveAllFences

procedure MoveAllFences (  Adx  ,  Ady  :  Integer  )  ;  virtual  ;

MoveAllFences fences all the selected objects to the given coordinates in Adx, Ady.


MoveAll

procedure MoveAll (  var  Adx  ,  Ady  :  Integer  ;

                                  AClickPoint  :  TPoint  ;

                                  X, Y  :  Integer  )  ;  virtual  ;

MoveAll fences all the selected objects to the given coordinates in Adx, Ady by calls to move all fences. MoveAll calculates the position of the fences using ClickPoint and the current position of the mouse.


EndMoveAll

procedure EndMoveAll (  AdX  ,  Ady  :  Integer  )  ;  virtual  ;

EndMoveAll actually calls Resize for all the selected objects in the current move selection this has the effect of moving all the objects to that position.


GetHandleType

function GetHandleType (  AHandle  :  Integer  )  :  THandleType  ;  virtual  ;

GetHandleType returns default types in the range

THandleType = ( hCustom, hNull , hTopLeft , hTopMid ,

                           hTopRight, hMidRight ,hBottomRight,

                           hBottomMid, hBottomLeft, hMidLeft, hDefault ) ;

GetCursorFromHandleType uses the return of this function to return the cursor for the given handle index in Ahandle.


GetCursorFromType

function GetCursorFromType (  AHandleType  :  THandleType  )  :  TCursor  ;  virtual  ;

GetCursorFromType returns the cursor for a given handle type.

The cursor returned are in the given range of :

AHandleType =    hNull                              : GetCursorFromType := crArrow ;

                            hTopLeft, hBottomRight : GetCursorFromType := crSIZENWSE ;

                            hTopMid, hBottomMid    : GetCursorFromType := crSIZENS ;

                            hTopRight, hBottomLeft : GetCursorFromType := crSIZENESW ;

                            hMidRight, hMidLeft       : GetCursorFromType := crSIZEWE ;

                            hCustom                        : GetCursorFromType := crDefault ;


FenceTimeHandler

procedure FenceTimeHandler (  Sender  :  TObject  )  ;  virtual  ;

FenceTimeHandler is assigned to the timer created in the create constructor of the DrawSurface. When called it disables the timer and sets the FenceType field to ftFenceBetter. This is interpreted by all DrawObjects as the time to display higher quality fences during fencing or stretching.


GetSelectionRect

function GetSelectionRect  :  TRect ; virtual  ;

GetSelectionRect returns the rectangle that fully encloses all the curently selected objects.


ReadState

procedure ReadState (  Reader  :  TReader  )  ;  override  ;

Calls Inherited ReadState and sets the Modifed flag to false.


GetToolFromObject

function GetToolFromObject (  ADrawObject  :  TDrawObject  )  :  TTool  ;  virtual  ;

GetToolFromObject attempts to find the tool which created it or a tool with its DrawObject field set of the same type as itself. It returns this tool if successfull otherwise it returns nil.


GetObjectsRect

function GetObjectsRect  :  TRect ; virtual  ;

GetObjectsRect returns the rectangle which completely surrounds all the draw objects in the DrawObjects list.


SetScrollers

procedure SetScrollers (  ARect  :  TRect  )  ;  virtual  ;

SetScrollers is called whenever scrollers may need to be shown or removed. This function does nothing but may be overriden if this functionality is neccessary.


ShowScroller

procedure ShowScroller (  AScrollBarKind  :  TScrollBarKind  ;

                                           AShow  :  Boolean  )  ;  virtual  ;

Given AScrollBarKind ShowScroller attempts to hide or show the scroller of that type acording to the boolean AShow.


SetParent

procedure SetParent (  AParent  :  TWinControl  )  ;  override  ;

SetParent is called by the Parent property. It sets the parent and if the parent is a TForm assigns the DrawSurfaces own CloseQuery to the forms close query. This allows the form to process data prior to a close down of its self. Close query by default checks the modifed flag and shows a message box requesting if the user wishes to save the changes.


GetSaveName

function GetSaveName (  var  CanClose  :  Boolean  )  :  String  ;

GetSaveName executes a save dialog to return the name the user wishes to call his new draw objects file.


CheckNoName

procedure CheckNoName (  const  AFilename  :  String  ) : Boolean ;

CheckNoName checks if the current DrawObjects file has been given a name or not.  The result is true if the file has no name. The default noname is NoName.tmp.


GetTool

functoin GetTool  :  TTool  ; virtual  ;

GetTool is called by the tool property of DrawSurface. GetTool returns Ftool if it is not nil or searches for the tool that is down within the tools in your application.


PartAdded

procedure PartAdded (  ADrawObject  :  TDrawObject  )  ;  virtual  ;

PartAdded is called wehever a part has been added to the a DrawObject. PArtAdded calls the DrawObjects mother objects AfterAddPart method passing Self and the current DrawObject.


GetRectFromList

function GetRectFromList (  AList  :  TList  )  :  TRect  ;  dynamic  ;

Given Alist which is expected to be a list of DrawObjects GetRectFromList will return the exact rectangle that will completely surround the given list of objects. Nothing will happen if any of the objects are not DrawObjects since each object is chaeck using runtime type information.


GetActive

function GetActive  :  Boolean  ; virtual  ;

GetActive atempts to acertain the current active status of its parent form this is called by the Active property


FileName

Filename stores the name of the file which will be used in any saving operations on the DrawSurfaces set of drawobjects stored in the DrawObjects list. Filename is set in LoadDrawObjects and by SaveDrawObjects if the SaveType is set to stSaveAs.


SelectedObjects

SelectedObjects always stores a list of all the selected objects on the the DrawSurface. This list is maintained by the DrawSurface and is used by many of its functions.

You may use this list in your own software but it is not advisable to change the list in any way during the operation of the software. DrawObjects in the selected list may also be in the DrawObjects list simltaneously.


DrawObjects

DrawObjects stores a list of all the objects on the the DrawSurface. This list is maintained by the DrawSurface and is used by many of its functions.

You may use this list in your own software. Cation is advised since objects in this list may also be in the selected list at the same time. Use removeObject to remove an object from the form, you must then remove the same object from the Selected list also.


Create

constructor Create (  AnOwner  :  TComponent  )  ;  override  ;

This create constructor sets all the default values for the DrawSurface.

The DrawObjects list is created by a call to CreateDrawObjects.  The SelectedObjects list is created here also.  DeletedList is created.Self is inserted into a list of all drawsurfacess at this time.

The Default placing cursor is loaded from the resource file. The Grid is created. The fence timer is created at this point.

The following flags are set :

Adding := False ;

Selecting := False ;

Modified := False ;

AutoScrolling := False ;

NewObjectFlag := False.


Destroy

destructor Destroy  ;  override  ;

This destructor frees up all lists associated with the DrawSurface and removes Self from the DrawSurfacesList.


CreateDrawObject

function CreateDrawObject (  ATool  :  TTool  ;

                                               ABounds  :  TRect  ;

                                               var  InitialHandle  :  Integer  ;

                                               var  ABaseObject  :  TDrawObject  ;

                                               var  AnAdding  :  Boolean  )  :  TDrawObject  ;  dynamic  ;

CreateDrawObject either creates a new DrawObject, inserting it into both the DrawObjectsList and SelectedObjects list and repaints or adds a [art to an existing multipat object.

Object creation

ATool is the tool that caused this method to be called and its DrawObject is used for the creation process.

DrawObjects can be created with bounds that are not set to empty. The initial bounds are set in Abounds. Initialhandle is the initial handle that will be stretched, this is usualy set to 1. AbaseObject is the mother object that this is being created from and is the same as the DrawObject in the Tool.

Adding to an existing object

AnAdding is set inside CreateDrawObject method if the tool detects that we are adding to an existing DrawObject.


PlaceNewObject

function PlaceNewObject (  AnOwner  :  TComponent  ;

                                            ABaseObject  :  TDrawObject  ;

                                            ABounds  :  TRect  ;

                                            ASelect  :  Boolean  )  :  TDrawObject  ;  dynamic  ;

PalceNewObject takes ABaseObject which is a mother object ( the component that is droped on at design time ) and creates a DrawObject which is setup with a call to SetupDrawObject, resized by a call to Resize then inserted into the DrawObjects list and if ASelect is true, the SelectedObjects list.

The DrawObject is then Invalidated and its bounds are set to those coordinates passed in ABounds.


GetObjectRect

function GetObjectRect (  X  ,  Y  :  Integer  )  :  TRect  ;  virtual  ;

GetObjectRect returns a Rect with its Left and Right set to X and its Top and Bototm set to Y by default.


PointerIn

function PointerIn (  X  ,  Y  :  Integer  ;

                               AnExclude  :  TDrawObject  ;

                               var  AHandle  :  Integer  )  :  TDrawObject ; virtual ;

PointerIn returns the DrawObject in which the coordinates X, can be found. AnExclude can contain a DrawObject which will be ignored during the search process. Ahandle is set to the handle that X, and Y are within. Pointer in searches through all handle first allowing handle movement even under other objects.


BringObjectsToFront

procedure BringObjectsToFront  ;  virtual  ;

BringObjectsToFront brings all selected objects to the front of the DrawSurface,  that is to say sets their Z order to be above all others.


SendObjectsToBack

procedure SendObjectsToBack  ;  virtual  ;

SendObjectsToBack sends all selected objects to the back of the DrawSurface,  that is to say sets their Z order to be below all others.


KeyUp

procedure KeyUp (  var  Key  :  Word  ;

                                Shift  :  TShiftState  )  ;  override  ;

Key up is called when a keup event is detected in the DrawSurface.


ObjectChanged

procedure ObjectChanged (  AnObject  :  TDrawObject  ;

                                              AChangeType  :  TChangeType  )  ;  virtual  ;

Not used.


Undo

procedure Undo (  AnUndoState  :  TUndoState  )  ;  virtual  ;

Undo utilizes the UndoList calling the undo object at FUndoPosition and running it, performing any undoing or redoing that needs to be done.


GetSelectedObject

function GetSelectedObject  :  TDrawObject  ; virtual  ;

GetSelectedObject returns the currently selected object stored inCurendSelected.


RemoveAllSelected

procedure RemoveAllSelected  ;  virtual  ;

RemoveAllSelected removes all selected objects fron the DrawSurface and Invalidtaes. An undo is posted.


PostUndo

procedure PostUndo (  AnUndoObject  :  TUndoObject  )  ;  virtual  ;

PostUndo posts an UndoObject to the undo list, it also increments or decrements the current undo position.


LoadDrawObjects

procedure LoadDrawObjects (  AFileName  :  String  ;

                                                  AnOpenMode  :  TOpenMode  ;

                                                  AForm  :  TForm  )  ;  virtual  ;

This section not complete in this version of the help files.


SaveDrawObjects

procedure SaveDrawObjects (  AFileName  :  String  ;

                                                   AForm  :  TForm  )  ;  virtual  ;

This section not complete in this version of the help files.


PrintDrawObjects

procedure PrintDrawObjects  ;  virtual  ;

This section not complete in this version of the help files.


GetMotherObject

function GetMotherObject (  ADrawObject  :  TDrawObject  )  :  TDrawObject  ;  virtual  ;

This section not complete in this version of the help files.


GetToolFromObjectType

function GetToolFromObjectType (  ADrawClass  :  TDrawClass  )  :  TTool  ;  virtual  ;

This section not complete in this version of the help files.


GetToolFromType

function GetToolFromType (  AToolType  :  TToolClass  )  :  TTool  ;  virtual  ;

This section not complete in this version of the help files.


Zoom

procedure Zoom (  APercentage  :  Integer  )  ;  virtual  ;

Not implemented in this version.


CloseQuery

procedure CloseQuery (  Sender  :  TObject  ;

                                         var  CanClose  :  Boolean  )  ;  virtual  ;

This section not complete in this version of the help files.


CreateWrapper

function CreateWrapper (  const  AnExt  :  String  ;

                                          AList  :  TList  )  :  TPictureWrapper  ;  dynamic  ;

This section not complete in this version of the help files.


SaveAsType

procedure SaveAsType (  const  AFileName  :  String  )  ;  dynamic  ;

This section not complete in this version of the help files.


PlaceWrapper

procedure PlaceWrapper (  AWrapper  :  TPictureWrapper  ;

                                            AnX  ,  AY  :  Integer  )  ;  dynamic  ;

This section not complete in this version of the help files.


ObjectCreated

procedure ObjectCreated (  ADrawObject  :  TDrawObject  ) ; virtual ;

This section not complete in this version of the help files.


RemoveObject

function RemoveObject (  ADrawObject  :  TDrawObject  )  :  Boolean  ;  virtual;

This section not complete in this version of the help files.


DBLClick

procedure DBLClick  ;  override  ;

This section not complete in this version of the help files.


OnObjectCreation

OnObjectCreation  :  TObjectCreateEvent  read  FObjectCreation  write  FObjectCreation  ;

This section not complete in this version of the help files.


OnGetDrawObjects

OnGetDrawObjects  :  TGetDrawObjectsEvent read FGetDrawObjects  write  FGetDrawObjects  ;

This section not complete in this version of the help files.


Tool

Tool  :  TTool  read  GetTool  write  FTool  ;

Tool stores the tool which will be used from creating objects or the PointerTool.


Active

Active  :  Boolean  read  GetActive  ;

Read only.  Active stores the activation status of the DrawSurface.


Placing

Placing  :  Boolean  read  FPlacing  write  SetPlacing  default  False  ;

Placing is set ot true when an a graphic object is waiting to be placed. This is set in LoadDrawObjects when ever a placeable object is loaded and the OpenMode is omPlace.


Canvas

Canvas : TCanvas ;

Not used. Must not be changed.


FUseGrid

FUseGrid : Boolean

If this is true then DrawSurface displays the current grid style on the DrawSurface.


FGrid

FGrid : TGrid

FGrid stores the property Grid. It is the current grid type.


FPlaceCursor

FPlaceCursor : String

FPlaceCursor stores the resource name of the cursor image that will be used when placing graphic objects.


PlaceCursorID

The PlaceCursor. This is set automaticaly at runtime.


SetUseGrid

procedure SetUseGrid (  ABoolean  :  Boolean  )  ;

Sets the FUseGrid flag to Abooelan, and then invalidates the DrawSurface.


SetGrid

procedure SetGrid (  AGrid  :  TGrid  )  ;

Sets Fgrid to be AGrid.


PaintToDC

function PaintToDC (  AList  :  TList  ;

                                   DC  :  HDC  )  :  TRect  ;

PaintToDC takes a list of DrawObjects in list and a HDC in DC and paint the DrawObjects to that DC.  PaintToDC also returns the rectangle that completely encloses the List of DrawObjects


Align

Align  : TAlign;

Align can be set at run ad design time to align the DrawSurface relative to its parent and peer windows.


Color

Color : TColor ;

Color sets the color of the DrawSurface.


PlaceCursor

PlaceCursor  :  String  read  FPlaceCursor  write  FPlaceCursor  ;

PlaceCursor stores the resource name of the cursor image that will be used when placing graphic objects.


FenceInterval

FenceInterval  :  Integer  read  FFenceInterval  writeSet FenceInterva ;

This value can be set at design and run time and determines the amount of time required to hold the mouse key down on an object without moving before its fencing will be set to ftFenceBetter. The interval is set in miliseconds and defaults to 300.


UseGrid

UseGrid  :  Boolean  read  FUseGrid  write  SetUseGrid  ;

If this is true then DrawSurface displays the current grid style on the DrawSurface and invalidates.


Grid

Grid  :  TGrid  read  FGrid  write  SetGrid  ;

Stores the Grid which can be canged at run and design times.

Grid

the Grid has

    GridX       : Integer ;

    GridY       : Integer ;

    Pen          : TGridPen ;

    GridType  : TGridType ;

GridX and GridY are the sizes of the grid cells on the X and Y axis respectively.

The Pen determines the color of the Grid and the Grid type the shape of the Grid. gtDot, gtLine and gtNone. If the GridType is set to gtNone but the UseGridFlag is set to true then the effects of the grid will remain but ther will be no visible grid.


OnMouseDown

OnMouseDown  ;

OnMouseDown is an event posted when there is a mouse down event on the DrawSurface.


OnMouseMove

OnMouseMove  ;

OnMouseMove is an event posted when there is a mouse move event on the DrawSurface.


OnMouseUp

OnMouseUp  ;

OnMouseUp is an event posted when there is a mouse up event on the DrawSurface.


OnPaint

OnPaint  :  TPaintObjectEvent  read  FPaint  write  FPaint  ;

OnPaint is an event posted whenever the DrawSurface is repainted..


OnCreateObject

OnCreateObject  :  TNotifyEvent  read  FOnCreateObject  write  FOnCreateObject  ;

 OnCreateObject is an event posted everytime a DrawObject is created.


UndoPosition

UndoPosition  :  Longint  read  FUndoPosition  write  FUndoPosition  ;

UndoPosition stores the current undo position.


DrawKit

TDrawClass

TGraphicClass

TUndoObject

TUndoClass

TUndoPosition

TUndoCreate

TUndoDelete

TUndoMove

TUndoAddPart

TToolClass

TToolBox

TTransForm

TDrawObject

TSelectionRect

TPictureWrapper

TDrawPoint

TMultiPartObject

TTool

TBitmapFencer

TGridPen

TGrid

TDrawSurface


TDrawClass


TGraphicClass


TUndoObject

Fields

DrawObject

Methods

Create

Undo


TUndoClass


TUndoPosition

Fields

dx

dy

Handle

CopiedBounds

Methods

Create

Undo


TUndoCreate

Fields

CopiedDrawObject

BaseObject

Methods

Create

Undo


TUndoDelete

Methods

Undo


TUndoMove

Fields

MoveList

dx

dy

Methods

Create

Destroy

Undo


TUndoAddPart

Fields

x

y

Handle

Methods

Create


TToolClass


TToolBox

Properties

Align

Color


TTransForm

Fields

FxScale

FyScale

FxSkew

FySkew

FxOffSet

FyOffset

Methods

Create

SetupTransform

Properties

xScale

yScale

xSkew

ySkew

xOffSet

yOffset


TDrawObject

Fields

FOnRemove

Parent

FEffectTool

FTransForm

DragPoint

Created

ToolType

FBounds

MotherObject

FHalfHandle

HalfWidth

HalfHeight

FPaint

FPaintHandles

FSelected

FStretchFence

FInvalidBounds

FParentSurface

FChangeObjects

Methods

ReadState

WriteState

GetBounds

ToolChanged

SnapToGrid

CalculateBounds

SetObjectX

SetObjectY

GetObjectX

GetObjectY

SetWidth

SetHeight

GetWidth

GetHeight

GetHandleRect

GetHandleRectPT

Create

Destroy

AreaSelect

Select

SelectHandle

Paint

SetCanvas

SetFencingCanvas

PaintObject

ResetCanvas

HitTest

GetHandle

InvalidateObject

CalcRect

StretchFence

Fence

Resize

DrawHandle

DrawHandleFromPoint

DrawHandles

DrawStretchHandles

MouseDrag

MouseUp

MouseDown

SetupDrawObject

AddPart

PartHandle

Undo

PostUndo

AfterCreate

AfterAddPart

GetCursor

GetInvalidBounds

SetParentSurface

GetParentSurface

ApplyTransform

TransformPoint

Rotate

Scale

Translate

Skew

Properties

OnRemove

Bounds

InvalidBounds

ParentSurface

ObjectX

ObjectY

Width

Height

Transform

HalfHandle

OnPaint

OnPaintHandles

OnStretchFence

Selected

EffectTool

ChangeObjects


TSelectionRect

Fields

StoredDX

StoredDY

Methods

CalcRect

DrawHandles

Fence

InvalidateObject

MouseUp


TPictureWrapper

Properties

Picture

Ext

Methods

ReadState

WriteState

GetExt

SetCanvas

LoadCreate

Create

Destroy

SaveToFile

Paint

CalculateBounds


TDrawPoint

Fields

FCurveBefore

FCurveAfter

FSameLength

FSameAngle

FStatus

FPointType

Point

Handles

Methods

Create

CreateCopy

ReadState

WriteState

Properties

Status

PointType

CurveBefore

CurveAfter

SameLength

SameAngle


TMultiPartObject

Fields

SetupFlag

Methods

Create


TTool

Fields

CursorID

FOnGetDrawClass

FDrawClass

FToolClick

FToolCursor

FCursorName

FInformClick

FEffectDistant

FDrawObject

Methods

SetParent

UnplugObject

Create

Destroy

ToolClick

Click

CreateObject

ReadState

SetDrawClass

SetDrawObject

GetCursor

ObjectChanged

GetActiveDrawSurface

Properties

DrawClass

ActiveDrawSurface

OnGetDrawClass

GroupIndex

DrawObject

OnToolClick

ToolCursor

CursorName

InformClick

EffectDistant


TBitmapFencer

Fields

FFenceBitMap

Methods

Create

Destroy

GetFenceBitmap

Fence

DrawHandles

Properties

FenceBitmap


TGridPen

Fields

Grid

Methods

Create

Changed


TGrid

Fields

Parent

FGridX

FGridY

FPen

FGridType

Methods

Create

DrawGrid

InvalidateGrid

SetGridX

SetGridY

SetGridPen

SetGridType

Properties

GridX

GridY

Pen

GridType


TDrawSurface

Fields

LButtonDown

CurrentDrawObject

CurrentSelected

CurrentHandle

OldViewPortExtents

OldWindowExtents

UndoList

DeletedList

ClickPoint

dx

dy

FSelectionRect

NewObjectFlag

NotedPoint

FenceType

BitmapFencer

Adding

Selecting

Modified

AutoScrolling

CursorPoint

PlaceableWrapper

FPaint

FTool

FOnCreateObject

FFenceInterval

FUndoPosition

FCurrentUndoObject

FObjectCreation

FGetDrawObjects

FPlacing

FenceTimer

FileName

SelectedObjects

DrawObjects

FUseGrid

FGrid

FPlaceCursor

PlaceCursorID

Methods

SetFenceInterval

SetPlacing

Paint

PaintDrawObjects

MouseDown

MouseMove

MouseUp

GetObjectFromPoint

CreateDrawObjects

DoneDrawObjects

Select

DeselectAll

AreaSelect

MoveAllFences

MoveAll

EndMoveAll

GetHandleType

GetCursorFromType

FenceTimeHandler

GetSelectionRect

ReadState

GetToolFromObject

GetObjectsRect

SetScrollers

ShowScroller

SetParent

GetSaveName

CheckNoName

GetTool

PartAdded

GetRectFromList

GetActive

Create

Destroy

CreateDrawObject

PlaceNewObject

GetObjectRect

PointerIn

BringObjectsToFront

SendObjectsToBack

KeyUp

ObjectChanged

Undo

GetSelectedObject

RemoveAllSelected

PostUndo

LoadDrawObjects

SaveDrawObjects

PrintDrawObjects

GetMotherObject

GetToolFromObjectType

GetToolFromType

Zoom

CloseQuery

CreateWrapper

SaveAsType

PlaceWrapper

ObjectCreated

RemoveObject

DBLClick

SetUseGrid

SetGrid

PaintToDC

Properties

OnObjectCreation

OnGetDrawObjects

Tool

Active

Placing

Canvas

Align

Color

PlaceCursor

FenceInterval

UseGrid

Grid

OnMouseDown

OnMouseMove

OnMouseUp

OnPaint

OnCreateObject

UndoPosition


Creating SDI applications
Creating an SDI DrawKit application

It is simple to create a DrawKit single document interface application without any coding what so ever. You will need the following components from the DrawKit palette.

For the simplest solution create the application using the SDI DrawKit application template in the gallery, with the image above.

The components

 	The main component of a DrawKit application is the DrawSurface.

 	If you have the Mobius ToolBox then you could drop

this on for a convient place to put all your tools. You may want to use

TMoveableDock to place your ToolBox in.

TPointerTool, used to manipulate all draw objects.

Use tools to create or manipulate DrawObjects and DrawSurfaces.

Some DrawObjects, these draw objects will be created by the tools above.

Tools to assist in saving your work.

The steps

Firstly create a new form and give the form a name and caption.

Drop a DrawSurface on the form and a TMoveableDock.  Align the MoveableDock to the top of the form.

Drop a TToolBox inside the the dock 	and align this to client.

You then drop on as many TTools and TMultipartTools as necessary.

Giving the Tools a purpose

Each tool needs to know what object it is going to create. When you drop the Tool on the form the DrawObject field in the Tool will display all the DrawObject components on that form. To give the tool a DrawObject simply choose one of the DrawObjects in the DropDown list. Setting the DrawObject also sets the cursor and glyph in the tool also.  This glyph 	needs to be drawn and saved in a resource file that is included into your 	application. If you wish you can load a new glyph for the tool in design 	mode by clicking on the Glyph property in the property editor.

Tools do not need to be placed in a Toolbox however the toolbox gives you the draging and docking capibilties.

File handling

Drop the TOpen and TSave tools on to the ToolBox and Drop an OpenDialog and Save dialog components on the form. As with the DrawObject and tool relationship TOpen and TSave both have Dialog property.  Select the appropriate save or open dialog.  This selection process sets the filters in either of the dialogs automatically.

Scrolling

If you need scrolling abbilites then simply put the DrawSurface inside a scroll box component found in the component palette.


Creating MDI

It is simple to create a DrawKit multi document interface application with just a little coding. You will need the following components from the DrawKit palette.

For the simplest solution create the application using the MDI DrawKit application template in the gallery, with the image above.

The components

 	The main component of a DrawKit application is the DrawSurface.

 	If you have the Mobius ToolBox then you could drop

this on for a convient place to put all your tools. You may want to use

TMoveableDock to place your ToolBox in.

TPointerTool, used to manipulate all draw objects.

Use tools to create or manipulate DrawObjects and DrawSurfaces.

Some DrawObjects, these draw objects will be created by the tools above.

Tools to assist in saving your work.

The steps

Firstly create a new MDI application.

Drop a DrawSurface on the MDO child form and a TMoveableDock on the main appliction form.  Align the MoveableDock to the top of the form.

Drop a TToolBox inside the the dock and align this to client.

You then drop on as many TTools and TMultipartTools as necessary.

Giving the Tools a purpose

Each tool needs to know what object it is going to create. When you drop the Tool on the form the DrawObject field in the Tool will display all the DrawObject components on that form. To give the tool a DrawObject simply choose one of the DrawObjects in the DropDown list. Setting the DrawObject also sets the cursor and glyph in the tool also.  This glyph needs to be drawn and saved in a resource file that is included into your application. If you wish you can load a new glyph for the tool in design mode by clicking on the Glyph property in the property editor.

Tools do not need to be placed in a Toolbox however the toolbox gives you the draging and docking capibilties.

File handling

Drop the TOpen and TSave tools on to the ToolBox and Drop an OpenDialog and Save dialog components on the form. As with the DrawObject and tool relationship TOpen and TSave both have Dialog property.

Select the appropriate save or open dialog.  This selection 	process sets the filters in either of the dialogs automatically.

The TOpen tool has an event called OnLoadObjects. Use this to return a new MDIChidForm to the DrawSurface engine.

Scrolling

If you need scrolling abbilites then simply put the DrawSurface inside a scroll box component found in the component palette.


Creating a new Tool
Creating a new Tool.

All tools in Mobius DrawKit tm are subclassed from TTool found in the IDraw unit.

Tool is subclassed from the standard TSpeedButton and adds various properties and methods to TSpeedButton.

ToolClick

ToolClick is the method that you will override most often. ToolClick has one parameter, ADrawSurface. ADrawsurface is the currently active DrawSurface. ToolClick is called when the user clicks on the Tool. You may use any of the public methods, properties and fields of ADrawSurface in your code. ToolClick is a silent abstract method that does nothing in the Ttool so you dont need to call inherited if your Tool is subclassed directly from TTool.

DrawObjects and SelectedObjects

The lists DrawObjects and SelectedObjects are available to you. SelectedObjects always contains all the objects that are selected on the draw surface at any one time and is maintained automatically by the draw surface engine.

DrawObjects is a list of all the objects on the DrawSurface.

TTool and TNullTool

In general TTool is used to create a DrawObject on a DrawSurface and TNullTool is used for operations that will be applied to the DrawSurface, ie TUndo is a subclass of a TNullTool.

The Code

This is the declaration of a subclass of a TTool.

type

  TMyTool = class(TTool)

  public

    { Public declarations }

  protected

    { Protected declarations }

  private

    { Private declarations }

..published

    { Published declarations }

end;


Creating a new Draw object
Creating a new Draw object.

All Draw objects in Mobius DrawKit tm are subclassed from TDrawObject found in the IDraw unit.

TDrawObject is subclassed from the standard TComponent and adds many properties and methods to Tcomponent.

TDrawObject

TDrawObject gives the user all the functionality of stretching, resizing, fencing and painting.

TDrawObject will require the user to override at least the Paint method or to use the OnPaint event in the Delphi property editor. If either of these messages are not written then the DrawObject will only appear as a set of handles but will function correctly.

Writing your own DrawObject

   Painting the Object

     Override the Paint method and use the Bounds to position your

     painting. TDrawObjects paint method does nothing so you do not need to

     override it.

Fencing the Object

     Override the Fence method, using the ABounds parameter to

     paint your Fence. The Fence of your DrawObject is the outline of

     the DrawObject that will be seen during moving the object from one

     place to the next. StretchFence is called before the Fence method is

     and calculates where the fence will appear. You may want or need to

     override this if you are fencing a more complicated DrawObject.

  Resizing the Object

     Override the Resize method, using the ABounds parameter to

     paint your Fence. The Fence of your DrawObject is the outline of

     the DrawObject that will be seen during moving the object from one

     place to the next. StretchFence is called before the Fence method is

     and calculates where the fence will appear. You may want or need to

     override this if you are fencing a more complicated DrawObject

     Always call the Inherited Resize method.

The Code

This is the declaration of a subclass of a TDrawObject.

type

  TMyDrawObject= class(TDrawObject)

  public

    { Public declarations }

  protected

    { Protected declarations }

  private

    { Private declarations }

..published

    { Published declarations }

end;